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

created at 12-16-2021 views: 12

Problem Description

Starting the project today suddenly throws the following error message:

[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

Checking the information and finally came to the conclusion: MySQL needs to specify whether to make an SSL connection in the high version

solution

Set useSSL=false and change the connection URL as follows

jdbc:mysql://localhost:3306/test?useSSL=false
created at:12-16-2021
edited at: 12-16-2021: