背景:
把mysql-connector-java升级到了8.0.11,导致查询数据库时候出现了错误
错误信息:
Could not get JDBC Connection; nested exception is 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.原因:
没有明确时区
解决方案:
方式一:修改数据库url
jdbc:mysql://localhost:3306/springsecurity?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
方式二:修改数据库时区
mysql -hlocalhost -uroot -p show variables like '%time_zone%' set global time_zone='+8:00';

本文介绍了在将mysql-connector-java升级到8.0.11版本后出现的时区配置错误,并提供了两种解决方案:一是修改数据库URL中的时区参数;二是通过SQL命令设置全局时区。
5479

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



