编程那点事 编程那点事编程那点事

Caused by: java.sql.SQLException: The server time zone value 'xxx' is unrecognized or represents more than one time zone

项目:SpringBoot+Mysql

在使用的过程中报错,具体报错如下:

Caused by: 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.

有2种解决方法

方法1:

提示系统时区出现错误,可以在mysql中执行命令: set global time_zone='+8:00' 

方法2:

在驱动的URL后面加上serverTimezone=UTC,代码如下所示

jdbc:mysql://localhost:3306/cloud?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC


编程那点事 更专业 更方便

登录

找回密码

注册