Sometimes you run show processlist in MySQL, and you'll see that there are many of these processes in the database:
The reason for sleep is three, and the following is an explanation from the MySQL manual:
1. The client program did not invoke Mysql_close () before exiting. [Write program negligence, or database DB Class library does not automatically close each connection ... ]
2. The client sleep time does not issue any requests to the server within the Wait_timeout or interactive_timeout specified seconds. [Similar to a common connection, similar to an incomplete TCP IP protocol construct, the server always believes that the client is still present (it is possible that the client has been disconnected)]
3. The client program sends a request to the server before it ends and the result is not returned. [See: Three Handshake for TCP IP Protocol]
And the solution is simple.
Add in configuration file
Copy Code code as follows:
Or
Copy Code code as follows:
mysql> set global wait_timeout=10;