springboot2 链接mysql5.6时的问题

今天碰到一坑,特此记录
环境springboot2 mysql-connector-java 8.0.15链接mysql5.6
出现问题:java

java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110) ~[mysql-connector-java-8.0.15.jar:8.0.15]

连接url:mysql

url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false

代码在其余机器上测试过的,肯定是mysql版本引发的,搜了一下,各类各样的问题,最终都没有解决。spring

测试过程当中发现加入了sql

&serverTimezone=GMT%2B8
即完整url:
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8

问题解决springboot

相关文章
相关标签/搜索