欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

SpringBoot连接MySQL8.0报错:-The Server time zone value ‘�й���׼ʱ��’ is unrecognized or represents more

程序员文章站 2022-05-07 19:00:08
报错信息: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...

报错信息:

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.
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) ~[mysql-connector-java-8.0.16.jar:8.0.16]

解决方法:

在配置文件application.properties中,spring.datasource.url改为

spring.datasource.url=jdbc:mysql://localhost:3306/你的数据库名称?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=true

即增加:serverTimezone=UTC

 

本文地址:https://blog.csdn.net/qq_41138935/article/details/107311139