Connection连接mysql数据库,报错内容:
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:使用数据库命令设置时区
查看mysql时区设置

执行sql命令:set global time_zone=’+8:00’;
方案2:连接数据库url添加serverTimezone=UTC
eg.jdbc:mysql://localhost:3306/zhzuz?serverTimezone=UTC;
The server time zone value ‘乱码‘ is unrecognized or represents more than one time zone.
最新推荐文章于 2023-11-19 16:38:04 发布
本文介绍了当连接MySQL数据库时遇到的时区配置错误,并提供了两种解决方案:一是通过数据库命令直接设置时区;二是修改连接数据库URL中的时区参数。

284

被折叠的 条评论
为什么被折叠?



