MySQL configuration file
/etc/my.cnf
Editing a configuration file
[Email protected] ~]# VIM/ETC/MY.CNF
# The MySQL server
[Mysqld]
Port = 3306
Socket =/tmp/mysql.sock
Skip-locking
Key_buffer_size = 256M
Max_allowed_packet = 1M
Table_open_cache = 256
Sort_buffer_size = 1M
Read_buffer_size = 1M
Read_rnd_buffer_size = 4M
Myisam_sort_buffer_size = 64M
Thread_cache_size = 8
Query_cache_size= 16M
# Try number of CPU ' s*2 for thread_concurrency
Thread_concurrency = 8
The above configured display can be viewed in the previous section on "MySQL tuning " for understanding.
Let's add two lines of configuration to the original base.
Interactive_timeout = 8
Wait_timeout = 8
The second line configuration is dependent on the first row, there is no first line configuration, and the second row configuration is not valid, and the two configurations are used together.
The client sent over to query MySQL may have some sleep state, when it is processed after the link will not immediately disconnect, temporarily maintain the connection, but MySQL has a connection number limit, more than is not connected, so we have completed the connection number of connections to let it itself disconnected, this is Wait_ The role of timeout.
Another configuration is about "slow query"
MySQL will have some slow queries, such as which SQL execution is slow, how long to execute, we can go to record,
Open the log of the slow query (the above configuration is written down), two parameters of the first
Long_query_time = 1
Log_slow_queries =/data/mysql/slow.log
As long as it's more than a second, we go to record this "slow query", this configuration is very useful, when doing tuning this is an important reference, such as: Which SQL statement execution is slow, we will be based on this "slow query" log to judge.
Configuration of MySQL