Mybatis连接mysql的错误1

Mybatis连接mysql的错误信息如下:

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.

此时的问题错误消息已经说的很明白了,时区的问题,那么最简答的解决方法就是在Java连接mysql数据库的URL上做点手脚就行了,比如,我之前的url:

spring.dataSource.url=jdbc:mysql://localhost:3306/world?characterEncoding=UTF-8&useUnicode=true&useSSL=true

添加了以下有关时区的参数:

spring.dataSource.url=jdbc:mysql://localhost:3306/world?characterEncoding=UTF-8&useUnicode=true&useSSL=true&serverTimezone=UTC

就是多了这个参数:&serverTimezone=UTC,后面值GMT%2B8表示东八区,这样就可以了。

发布了96 篇原创文章 · 获赞 22 · 访问量 31万+

猜你喜欢

转载自blog.csdn.net/chuan_day/article/details/87890783