MySQL 8.0.x JDBC 连接MySQL报错 The server time zone value '�й���׼ʱ��' is unrecognized

 报错信息如下:
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.


解决办法:

在连接池写的格式如下:
jdbc:mysql://localhost:3306/database?serverTimezone=UTC



MySQL 8.0 的驱动程序名称:com.mysql.cj.jdbc.driver
MySQL 5.1 的驱动程序名称:com.mysql.jdbc.driver


MySQL 8 JDBC的连接程序:
spring.datasource.url=jdbc:mysql://localhost:3306/database?useSSL=false&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT
spring.datasource.username=root
spring.datasource.password=0000000
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

使用datagrip 和DBeaver 需要设置参数:serverTimezone=UTC

MySQL 8.0.x JDBC 连接MySQL报错 The server time zone value '�й���׼ʱ��' is unrecognized_第1张图片

你可能感兴趣的:(MySQL)