java连接数据库时,导入jar包mysql-connector-java-8.0.11/12报错,mysql-connector-java-8.0.20却正常运行的问题

.
报错:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
解决方法:
看一下
url=jdbc:mysql://127.0.0.1:3306/smbms?useSSL=true
useSSL=true 改为 false

更改后若是还有另一个报错!
报错:java.sql.SQLException: The server time zone value ‘?й???’ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver
(环境:mysql-connector-java-8.0.20.jar)

解决方法:
添加serverTimezone=Asia/Shanghai
url=jdbc:mysql://127.0.0.1:3306/smbms?useSSL=true&serverTimezone=Asia/Shanghai

你可能感兴趣的:(java,web)