mysql服务版本5.7,项目启动连接数据库时报错
Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: 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:
执行脚本
show variables like "%time_zone%"; #查看当前时区
set global time_zone = '+8:00'; #修改MySQL全局时区为北京时间

修改成功。
修改方法2:
修改mysql服务配置文件,my.cnf配置文件
修改 default-time_zone = '+8:00'
重启MySQL服务 重启mysql服务。
本文介绍了解决MySQL服务版本5.7中因时区设置不当导致的连接错误问题。提供了两种解决方案:一是通过执行SQL脚本直接修改MySQL的全局时区;二是更改my.cnf配置文件中的时区设置,并重启MySQL服务。
5475

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



