1. Questions
The program connection to the database is abnormal, as follows:
Could not create connection to database server. Attempted reconnect 3 times. Giving
2. Solutions
I tried a variety of solutions, and finally realized: MySQL connector- java.jar Inconsistent with the latest database version. The database is the latest version of 8
0.19,mysql-connector- java.jar It’s 5.0.6.
Solution: MySQL connector- java.jar Keep the same version number as the database.
The POM file is as follows, please check and modify the version by yourself; some versions are compatible, but it is better to keep them unified.
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.19</version>
</dependency>