报错内容:
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.
大概意思是:
服务器的时区价值”йʱ”无法识别或代表多个时区。如果希望利用时区支持,必须配置服务器或JDBC驱动程序(通过serverTimezone配置属性),以使用更特殊的时区值。
该报错信息是启动springboot项目在初始化mysql服务的时候出现的,一般是在连接本地mysql的时候出现错误。
解决办法:
# 设置全局时区 mysql> set global time_zone = '+8:00';
Query OK, 0 rows affected (0.00 sec)
# 设置时区为东八区 mysql> set time_zone = '+8:00';
Query OK, 0 rows affected (0.00 sec)
# 刷新权限使设置立即生效 mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
注意!!!
上面的方法重启mysql服务可能就会失效,在url后面追加
&serverTimezone=GMT%2B8
可以解决。