The solution to the linkfailure problem caused by mysql not being accessed for a long time. I have developed an ssh-based system that uses mysql, but a strange problem occurs. every time I access the system and use it again the next day, an error will occur, check the error log, and the problem of mysql link failure occurs. later, I searched for relevant information on the Internet and explained that mysql will be automatically disconnected after the connection lasts for more than 8 hours. I have said that I modified the timeout on the Internet, I have tried to add autoreconnect and have not solved the problem. Later, I finally found the root cause in an article. mysql was disconnected for 8 hours and the connection pool was not disconnected. when we went to access the system the next day, the system still obtained data from the connection pool, in fact, mysql has been disconnected, so an error occurs when obtaining data. I configured the connection pool and database connection, and released the idle connection in time to solve the problem. For specific configuration, see the following:
The following attributes are used to configure when to release a connection:
You can set this time parameter by yourself, hoping to help your friends who encounter the same problem.