Mysql The server time zone value '�й���׼ʱ��' is unrecognized or represents more

137 阅读1分钟

Java 连接Mysql 提示异常:Caused by: com.mysql.cj.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 specific time zone value if you want to utilize time zone support. 网上查询相关错误源头为“Mysql默认的时区比东八区少了八个小时”。

根源解决办法为修改Mysql安装目录下的my.ini配置文件添加

default-time_zone = '+8:00'

后重启Mysql。

image.png