The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.

在使用spring-boot-jpa出现一个问题,

WebApplicationContext: initialization completed in 1146 ms
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2019-04-18 09:36:20.935  INFO 14268 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2019-04-18 09:36:20.936  WARN 14268 --- [           main] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
2019-04-18 09:36:22.009 ERROR 14268 --- [           main] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Exception during pool initialization.

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.15.jar:8.0.15]
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.15.jar:8.0.15]
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[mysql-connector-java-8.0.15.jar:8.0.15]
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[mysql-connector-java-8.0.15.jar:8.0.15]
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) ~[mysql-connector-java-8.0.15.jar:8.0.15]
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76) ~[mysql-.........................................................

红色部分告诉我,这个com.mysql.jdbc.Driver已经被废弃,需要使用com.mysql.cj.jdbc.Driver。

百度一下,几个方法     

1,修改啥时区。。。。。。对我来说是无效了,

2.  链接字符串: jdbc:mysql://localhost:3306/XXX?useUnicode=true&useJDBCCompliantTimezoneShift=true&

           useLegacyDatetimeCode=false&serverTimezone=UTC    (在这指定serverTimezone)

这个有效

3.  修改自己的   mysql-connector-java版本。我的是8.多少来着,这个太高了,所以报错说我的啥啥啥废弃了,

把版本换成5点多少。。也就不会有上面两个错误了


 

          

 

你可能感兴趣的:(MYSQL连接)