您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

mysql错误:java.sql.SQLException: The server time zone value '?й???????' is unrecognized or represents more than one time zone.

bubuko 2022/1/25 20:10:07 mysql 字数 1957 阅读 982 来源 http://www.bubuko.com/infolist-5-1.html

java.sql.SQLException: The server time zone value '?й???????' is unrecognized or represents more than one time zone. You must configure either the ser ...

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.

技术分享图片

 

 

 这是SpringBoot整合MySQL的依赖包版本过高,在高版本的MySQL依赖中数据库和系统时区差异所造成的。系统为SQL默认美国时间,而我们中国要比他们迟8小时,因此将时区设置为当前系统时区即可,采用+8:00格式

 

两种解决方案

1.降低 mysql-connector-java依赖版本 (使用5.1.x版本即可)

<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>5.1.35</version>
</dependency>    

2.在JDBC连接url后添加时区属性:

&serverTimezone=GMT%2B8

 

mysql错误:java.sql.SQLException: The server time zone value '?й???????' is unrecognized or represents more than one time zone.

原文:https://www.cnblogs.com/npeng/p/12366080.html


如果您也喜欢它,动动您的小指点个赞吧

除非注明,文章均由 laddyq.com 整理发布,欢迎转载。

转载请注明:
链接:http://laddyq.com
来源:laddyq.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


联系我
置顶