java.sql.SQLException: The server time zone value is unrecognized or represents more than one time zone

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.

使用druid1.2.5和mysql8.0.20连接数据报以上错误信息,搜索得知

https://blog.csdn.net/qq_43072399/article/details/103102934

https://www.freesion.com/article/8764679361/

 

需要在连接字符串后面加上useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai

 

DruidPlugin dp = new DruidPlugin("jdbc:mysql://localhost/db_name?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai", "userName", "password");

 

posted @ 2021-02-24 15:53  _海阔天空  阅读(82)  评论(0编辑  收藏  举报