JDBC Mysql8.0报错The server time zone value ‘?й??? is unrecognized or represents more than one time z

ゝ一纸荒年。 2023-02-23 03:39 59阅读 0赞

is unrecognized or represents more than one time zone. You must configure either the server 。。。

这个报错是时区的问题,解决的办法有两种,一种是去mysql中
SET GLOBAL time_zone = '+8:00'
即把时区改为东八区。

或者是在jdbc的链接串中,带上如下信息
"jdbc:mysql://localhost/db?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC"

其中useLegacyDatetimeCode默认开启,关闭后时区相关信息会失效。

发表评论

表情:
评论列表 (有 0 条评论,59人围观)

还没有评论,来说两句吧...

相关阅读