DateSourceHikariCP - Failed to validate connection

DateSourceHikariCP - Failed to validate connection

Scroll Down

最近使用springboot2.0+hikari连接池,程序在过段时间访问数据库就会报下面错误:


2020-01-22 22:17:10 WARN  PoolBase:176 - DateSourceHikariCP - Failed to validate connection com.mysql.jdbc.JDBC4Connection@6abdb43e (Communications link failure

The last packet successfully received from the server was 980,321 milliseconds ago.  The last packet sent successfully to the server was 5,000 milliseconds ago.). Possibly consider using a shorter maxLifetime value.
2020-01-22 22:17:15 WARN  PoolBase:176 - DateSourceHikariCP - Failed to validate connection com.mysql.jdbc.JDBC4Connection@4efcb030 (Communications link failure

The last packet successfully received from the server was 1,048,069 milliseconds ago.  The last packet sent successfully to the server was 5,001 milliseconds ago.). Possibly consider using a shorter maxLifetime value.
2020-01-22 22:17:20 WARN  PoolBase:176 - DateSourceHikariCP - Failed to validate connection com.mysql.jdbc.JDBC4Connection@49ba5a72 (Communications link failure

The last packet successfully received from the server was 1,049,315 milliseconds ago.  The last packet sent successfully to the server was 5,000 milliseconds ago.). Possibly consider using a shorter maxLifetime value.
2020-01-22 22:17:25 WARN  PoolBase:176 - DateSourceHikariCP - Failed to validate connection com.mysql.jdbc.JDBC4Connection@40e07fd7 (Communications link failure

The last packet successfully received from the server was 1,044,367 milliseconds ago.  The last packet sent successfully to the server was 5,001 milliseconds ago.). Possibly consider using a shorter maxLifetime value.
2020-01-22 22:17:30 WARN  PoolBase:176 - DateSourceHikariCP - Failed to validate connection com.mysql.jdbc.JDBC4Connection@f2e918b (Communications link failure

The last packet successfully received from the server was 1,044,085 milliseconds ago.  The last packet sent successfully to the server was 5,001 milliseconds ago.). Possibly consider using a shorter maxLifetime value.





1.数据库连接问题

查看数据库的连接超时时间:

		SHOW VARIABLES LIKE "%timeout%";

在这里插入图片描述
查看数据库服务器上配值

vim /etc/my.cnf

在这里插入图片描述
一致

2.修改数据连接配置

在这里插入图片描述
未起作用
点击源码:
在这里插入图片描述
在这里插入图片描述
单位为毫秒 28800秒==28800000
暂时未发现问题

祝君好梦!