The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone.

[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以上的版本,然后就报了时区的错误

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • NAME dnsmasq - A lightweight DHCP and caching DNS server....
    ximitc阅读 7,943评论 0 0
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,397评论 19 139
  • 写到一半,不知道碰倒哪个箭头!竟然没有了。欲哭无泪,嘿嘿。可是突然转念一想,三分钟之前写出来的文章,会和你现在写的...
    笑莉说阅读 1,215评论 2 4
  • 写诗 好久没有写诗 每当写起诗 我终究不能抛开你 就像我忍不住拿起手机 给你发信息一样 这些天笔尖里流露出的都是你...
    夜以风阅读 1,657评论 0 0
  • 三年前的今天,也就是 2012 年 6 月 7 日,那天的北京是个阳光明媚日子,我拖着装着我来北京以后全部家当的行...
    upsDreamer阅读 1,124评论 0 1