Project error: java.sql.SQLNonTransientConnectionException: Could not create connection to database server solution

1. When using java to connect to the database JDBC, an error java.sql.SQLNonTransientConnectionException: Could not create connection to database server occurs.

2. The cause of the problem: mysql version problem, you need to download the corresponding mysql version, and you need to download the jar package version corresponding to mysql-connector.

3. Win+r enter cmd to check the version number of mysql.insert image description here

4. Download the corresponding mysql version, download link: https://downloads.mysql.com/archives/cj/

5. After installing mysql, you need to modify the mysql dependency version in pom.xml, then refresh the maven project, and finally the problem is solved!

Guess you like

Origin blog.csdn.net/qq_44872509/article/details/130194273