[Solved] init datasource error, url: jdbc:mysql://localhost:3306/test

Problem description

The following error message is suddenly thrown when starting the project today:

[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

reason

Finally, it is concluded that MySQL needs to specify whether to connect with SSL in the higher version

Solution:

Set usessl = false, and change the connection URL as follows

jdbc:mysql://localhost:3306/test?useSSL=false

Read More: