MySQL 经常出现这样的错误:
org.springframework.dao.DataAccessResourceFailureException:
PreparedStatementCallback;
SQL [select * from mytable where clom=?]; The last packet successfully received from the server was 1,547,682,071 milliseconds ago. The last packet sent successfully to the server was 1,547,682,072 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/Jconnection property 'autoReconnect=true' to avoid this problem.; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 1,547,682,071 milliseconds ago. The last packet sent successfully to the server was 1,547,682,072 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testingconnection 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.
解决办法:
登录MySQL:
set global interactive_timeout=28800000
set global wait_timeout=28800000
set session interactive_timeout=28800000
set session wait_timeout=28800000
希望对你有所帮助