[SpringBoot project] summarizes the problems and solutions

Problem: MySQL 8.0 version connection error: Could not create connection to database server

the reason

MySQL8.0 version of the need to replace the drive as "com.mysql.cj.jdbc.Driver", before "com.mysql.jdbc.Driver" no longer be used in MySQL 8.0 version of the official document links: HTTPS: // dev. mysql.com/doc/connector-j/8.0/en/connector-j-api-changes.html ;

solve

1. Update the mysql-connector-java version:

<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.11</version>
</dependency>

2. Replace drive

Reference links

https://cloud.tencent.com/developer/article/1371962

Thinking about solving problems encountered

1. In a small sleepy partners and solve their own code exactly the same, others have failed their own success, it has been tangled code and database tables, looking for differences.
But it did not consider is inconsistent and database versions jdbc issues, their own version of the database is relatively high, taking into account the inherent differences in those who can not see it.
2. error message only title search, no search for other critical information.
In fact, carefully read the error message, entirely by the last error message can be found, the error message can Soso ah.
3. Another alternative is to solve a small partner encountered the same problem, and soon to solve this problem estimates he only trapped in range Douzhuan no wrong, so to be more cooperative with others, ask.

Guess you like

Origin www.cnblogs.com/coding-gaga/p/11041923.html