通过 spring 引导连接 mysql 时出现时区问题,相当于 Mitteleuropäische Zeit

timezone issue while connecting with mysql via spring boot, whats equivalent of Mitteleuropäische Zeit

我在尝试连接 mysql 时遇到以下错误:

Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Mitteleuropäische Zeit' 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.

为了收到下面的问题,我已经经历了MySQL JDBC Driver 5.1.33 - Time Zone Issue

我正在使用以下 mysql 连接器:

mysql mysql-连接器-java 8.0.11

和申请属性如下:

db2.datasource.url=jdbc:mysql://www<><>06/esystem?useSSL=false&zeroDateTimeBehavior=convertToNull&useUnicode=trueuseLegacyDatetimeCode=false&serverTimezone=GMT+1

我用 CET 和 GMT+1 代替了 serverTimezone,但没有成功。任何解析点,什么可以是 "Mitteleuropäische Zeit"

的时区占位符

见于, you should use IANA timezone formats,喜欢Europe/Berlin

db2.datasource.url=jdbc:mysql://www<><>06/esystem?useSSL=false&zeroDateTimeBehavior=convertToNull&useUnicode=trueuseLegacyDatetimeCode=false&serverTimezone=Europe/Berlin