记录一下今天使用java连接部署在docker容器里的mysql遇到的问题,刚开始以为的跟正常的连接一样,结果报错
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
弄了有一会,发现还是没用,最后在一篇博客发现原来是配置上要加上
?useSSL=false
需要添加参数useSSL=false,或者配置ssl
即
spring.datasource.url=jdbc:mysql://192.168.6.128:3306/user?useSSL=false
就OK了