init datasource error, url: jdbc:mysql://localhost:3306/test 解决办法

问题描述

  • 今天启动项目突然抛出如下错误信息:
[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

版权声明:本文为github_38336924原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。