The server time zone value '��

2017-10-26  本文已影响0人  Abbott思宇

[TOC]

参考阅读

Hibernate连接MYSQL失败提示时区错误该怎么解决? - segmentfault
MySQL Connector/J 6.x jdbc.properties 配置, mysql-connector-java-6.0.4.jar 异常 - cnbolg
The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. - csdn
【坑】The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone - cnbolg

问题现象

com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: 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.

解决方案

方案1

在项目代码-数据库连接URL后,加上 (注意大小写必须一致)?serverTimezone=UTC

方案2

在mysql中设置时区,默认为SYSTEM set global time_zone='+8:00'

set global time_zone='+8:00';

问题原因

使用了Mysql Connector/J 6.x以上的版本,然后就报了时区的错误

上一篇下一篇

猜你喜欢

热点阅读