来源:
Mybatis使用MySQL中遇到的一个问题 | CodeDogluoliangdsga.github.io
来源:
https://blog.youkuaiyun.com/qq_30553235/article/details/79612824blog.youkuaiyun.com谢谢两位大佬
今天重装电脑后, 连接 MySql数据库出现了异常。
异常如下
java.sql.SQLException: The server time zone value ‘XXXXXX’ is unrecognized or represents more than one time zone.
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: (来源 LuoLiangDSGA的博客)
- 在 连接的 url 后面添加 serverTimezone=GMT
- 解决方法 2: (来源 totoroKing)
- 修改数据库的时区。两种方法
- 指令
- mysql>set global time_zone ='+08:00';
- mysql>set time_zone ='+08:00';
- 指令
- 修改
my.cnf
文件,在[mysqld]
节下增加default-time-zone = '+08:00'
。
- 修改数据库的时区。两种方法
建议看看 totoroKing 大佬的数据库时区问题的文章。