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

报错信息:

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

 

你可能感兴趣的:(开发ing)