Home >Database >Mysql Tutorial >MySQL的wait_timeout_MySQL

MySQL的wait_timeout_MySQL

WBOY
WBOYOriginal
2016-06-01 13:11:14978browse

没有修改过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 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn