解决MySQL报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents

使用spring boot 2.1.4.RELEASE + mybatis 出现MySQL报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents,从错误信息可以看出应该是mysql 时区设置错误。通过mysql客户端查询显示:

问题解决方法:

方法1:在数据库连接字符串中增加时区设置,如

spring.datasource.url=jdbc:mysql://localhost:3306/test?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8

方法2:修改mysql服务的设置my.ini,在mysqld节增加设置 default-time-zone='+08:00',修改后重启mysql服务。

猜你喜欢

转载自www.cnblogs.com/zzhuang/p/10706993.html