When accessing the MySQL database, the project often appears communications link failure error, which seems to be an idle connection over the database settings "Wait_timeout", MySQL will be out of the connection, The MySQL connection pool also considers the connection to be valid (the parameters for MySQL's wait_timeout settings are inconsistent with the timeout time of the connection pool settings, Wait_timeout > The time set by the connection pool), so the error occurs
Online look at a variety of methods, feel more reliable solution
First: On the URL of the connection database, add the parameter &autoreconnect=true&failoverreadonly=false
Second:
Modify MY.CNF: (my.cnf not found, directly changed My.ini file)
[Mysqld]
wait_timeout=31536000
interactive_timeout=31536000
Do you have any other ways to solve the problem?
There is also a problem, such as the problem shown above, why the feeling that the problem occurs and there is no fixed cycle, and the feeling is random appearance. And another question to ask is how MySQL distributes connections and how different connections differ. Will each connection be assigned a connection?
Mysql:communications Link Failure problem