MySQL修改时区,The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time

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服务。

猜你喜欢

转载自blog.csdn.net/weikzhao0521/article/details/96483346
今日推荐