java.sql.SQLException: The server time zone value �й���׼ʱ�� is unrecognized or represents ...

使用springboot 整合mybatis项目启动控制台报错:

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 (via the 'serverTimezone' configuration property) to use a more specifc time zone value if you want to utilize time zone support.

java.sql.SQLException: The server time zone value �й���׼ʱ�� is unrecognized or represents ...

原因是使用了Mysql Connector/J 6.x以上的版本,然后就报了时区的错误,解决方法:

    在配置url的时候不能简单写成 :

    jdbc:mysql://localhost:3306/test
    而是要写成 :
    jdbc:mysql://localhost:3306/test?serverTimezone=UTC

上一篇:LeetCode 129. Sum Root to Leaf Numbers - 二叉树系列题22


下一篇:Mysql连接异常java.sql.SQLException: The server time zone value '?й???????' is unrecognized or