Mysql solves the problem of automatically disconnecting the link bitsCN.com that has never been used for 8 hours.
Mysql automatically disconnects links that have not been used for 8 hours
Recently, many colleagues in the department reported that the database connection was automatically disconnected during mysql usage. I did some experiments on the problem.
The results of the study on mysql automatic disconnection are as follows. related parameter settings are available in mysql. when the database connection is idle for a certain period of time, the server
Will disconnect the connection waiting for timeout:
At the same time, only one of these two parameters works. Which parameter takes effect depends on the connection parameter specified during user connection. by default
Wait_timeout. I suggest modifying both parameters to avoid unnecessary troubles.
2. modify parameters
The default values of these two parameters are 8 hours. I tested changing these two parameters to 0, and the result is unexpected. The system automatically sets this value to 1. In other words, you cannot set this value to permanent. We recommend that you add three zeros to the parameter value to meet our application requirements.
Modify: open/etc/my. cnf and add the following parameters under the property group mysqld:
[Mysqld]
Interactive_timeout = 28800000
Wait_timeout = 28800000
In windows, add the following content in my. ini:
Interactive_timeout = 28800000
Wait_timeout = 28800000
BitsCN.com