java连接MySQL出现时区问题

问题报错内容:

Caused by: java.sql.SQLException: The server time zone value 'XXXXXXXXX' 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.   

解决办法:

直接到Mysqlclient里面设置,

1.# 设置全局时区

 mysql> set global time_zone = '+8:00';

2.# 设置时区为东八区

 mysql> set time_zone = '+8:00';

3.# 刷新权限使设置立即生效

 mysql> flush privileges;

再重启mysql

扫描二维码关注公众号,回复: 2049720 查看本文章


猜你喜欢

转载自blog.csdn.net/weixin_42296562/article/details/80859108