错误提示:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server
java项目连接jdbc报错:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server

相关的错误提示
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
原因:相关jar包版本太低,与mysql数据库的版本不匹配(例如8.0以上版本的数据库就应该使用mysql-connector-java-8.0.12)
解决方法:下载最新版的mysql-connector-java即可,网址:MySQL :: Begin Your Download
点击下图所示位置:

本文介绍了当使用Java项目通过JDBC连接MySQL时出现“Couldnotcreateconnectiontodatabaseserver”错误的原因及解决方法。主要是由于使用的mysql-connector-java版本过低,与MySQL数据库版本不匹配导致。文章提供了更新mysql-connector-java版本的具体步骤。
1065





