MySql中的time_out错误

MySql版本:5.5

部署的一个Web服务,日志报错:

The last packet successfully received from the server was 246,418,715 milliseconds ago.  The last packet sent successfully to the server was 246,418,715 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem

查询数据库的time_out变量:

MySql中的time_out错误
 原来是MySql数据库默认,wait_timeout是28800秒,如果8小时不连接数据库,就把这个连接断掉。