jdbc出现The server time zone value '?й???????' is unrecognized or represents more than one time zone.

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.

解决方法

首先我也是第一次运到这个问题,一开始还以为是自己的权限没有设置,然后一顿操作,没有任何进展,便去百度了一凡。

百度翻译是怎么解释的:

服务器时区值’?й???’ 无法识别或表示多个时区。如果要利用时区支持,则必须配置服务器或JDBC驱动程序(通过serverTimezone配置属性)以使用更具体的时区值。
使用的数据库是MySQL,这是问题由于数据库和系统时区差异所造成的,在jdbc连接的url后面加上serverTimezone=GMT即可解决问题,如果需要使用gmt+8时区,需要写成GMT%2B8,否则会被解析为空。再一个解决办法就是使用低版本的MySQL jdbc驱动,5.1.28不会存在时区的问题。

只要把数据库的地址改一下就可以了
如下所示即可

String url="jdbc:mysql://127.0.0.1:3306/jdbc?serverTimezone=GMT%2B8";

亲测有效

发布了29 篇原创文章 · 获赞 3 · 访问量 410

猜你喜欢

转载自blog.csdn.net/dwjdj/article/details/103578677
今日推荐