MySQL automatically disconnects in 15 minutes. How to maintain it and help solve it.

Alibaba cloud Q & A 2022-02-13 08:48:37 阅读数:907

mysql automatically disconnects minutes. minutes

There is no problem connecting to the database when the server window is initialized , You can find the data , then 15 No requests processed in minutes , 15 After a minute, the timer I set triggers , Update the database , It's just unusual , Say my MySQL Server lost connection

2013, 'Lost connection to MySQL server during query ([WinError 10060] Because the connecting party did not reply correctly after a period of time

But I checked my database , wait_timeout yes 28800 second , That is to say 8 Hours , Reason shouldn't 8 Hours to disconnect ?

I tested. , Just check the database every other minute , MySQL The server will not be disconnected , Why? 15 The connection is automatically disconnected without operating the database within minutes ?image.png

Take the answer 1:

Hello! , Long unused connections , To maintain , It's supposed to send heartbeat packets periodically . From client to server , There are a lot of nodes in the middle , Each of these nodes may break the connection to . such as ping() Reconnection 、DBUtils Connection pooling these methods are OK .

copyright:author[Alibaba cloud Q & A],Please bring the original link to reprint, thank you.