解决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 propert...问题

解决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 specific time zone value if you want to utilize time zone support.问题

报错信息:

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 specific time zone value if you want to utilize time zone support.

服务器时区值'�й���׼ʱ��' 无法识别或表示多个时区。如果要利用时区支持,必须将服务器或JDBC驱动程序(通过“serverTimezone”配置属性)配置为使用更具体的时区值。

 

解决方式:

在URL上添加serverTimezone=UTC

 

String url = "jdbc:mysql://localhost:3306/school?serverTimezone=UTC";

//在Mybatis中
jdbc:mysql://localhost:3306/mybatis?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT

 

 

 

参考:

https://blog.csdn.net/qq_43430011/article/details/114498695

(此链接中汇总了各种MySQL8.0 JDBC可能遇见的问题,非常具有参考价值。感谢。)

 
posted @   临易  阅读(150)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· 百万级群聊的设计实践
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性
点击右上角即可分享
微信分享提示