问题描述

  • 今天启动项目突然抛出如下错误信息:
[16:14:32.735][ERROR][com.alibaba.druid.pool.DruidDataSource][main] init datasource error, url: jdbc:mysql://localhost:3306/test
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

原因

  • 查资料最后得出结论:MySQL在高版本需要指明是否进行SSL连接

解决办法

  • 设置useSSL=false,更改连接URL如下
jdbc:mysql://localhost:3306/test?useSSL=false
Logo

本社区面向用户介绍CSDN开发云部门内部产品使用和产品迭代功能,产品功能迭代和产品建议更透明和便捷

更多推荐