Home >Database >Mysql Tutorial >MySQL的wait_timeout_MySQL
没有修改过MySQL的配置,缺省情况下,wait_timeout的初始值是28800
wait_timeout过大有弊端,其体现就是MySQL里大量的SLEEP进程无法及时释放,拖累系统性能,不过也不能把这个指设置的过小,否则你可能会遭遇到“MySQL has gone away”之类的问题
mysql> set global wait_timeout=20;
mysql> show global variables like 'wait_timeout';
+----------------------------+-------+
| Variable_name | Value |
+----------------------------+-------+
| wait_timeout |20 |
+----------------------------+-------+
今天发现很多sleep的进程,mysql给出的原因为3个:
1 The client program did not call mysql_close() before exiting.
2 The client had been sleeping more than wait_timeout or interactive_timeout seconds without issuing any requests to the server.
3 The client program ended abruptly in the middle of a data transfer