编程那点事编程那点事

专注编程入门及提高
探究程序员职业规划之道!

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


未经允许不得转载: 技术文章 » Java编程 » Caused by: java.sql.SQLException: The server time zone value 'xxx' is unrecognized or represents more than one time zone