springboot使用了阿里的数据库连接池Driud。
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
The last packet successfully received from the server was 319 milliseconds ago. The last packet sent successfully to the server was 319 milliseconds ago.
是否数据库的问题
测试客户端工具SQLyogEnt.exe是否连得上,连得上则不是数据库的问题
配置问题
在数据源的属性配置中加入
#配置可以在每次连接的时候判断一些连接是否有效
spring.datasource.druid.test-on-borrow=true
spring.datasource.druid.test-while-idle=true