项目场景:
问题描述
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.sql.SQLException: 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.
### The error may exist in StudentMapper.xml
### The error may involve ll.getAll
### The error occurred while executing a query
### Cause: java.sql.SQLException: 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.
原因分析
解决方案:
通过以下步骤解决了此问题:
打开命令窗口,进入mysql服务:
接着查询时区:
show variables like "%time_zone%";
这里显示SYSTEM表示跟随系统,一般情况下是没有问题的,但是偶尔也会出现问题,这里我们就直接更改成'+8:00'
set global time_zone='+08:00';
注意:这只是临时修改,重启mysql服务后就会失效
接下来再去idea里面测试一下。
发现结果还是报错,那么据考虑是idea数据库可视化插件的链接配置问题。
在这里加上时区’+8:00’,进行测试。完美解决。