关于springboot连接mysql数据库出现时域时差问题的解决

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.
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.
解决方法:

在配置数据库的url后面加上
serverTimezone=GMT%2B8 

修改后的代码:

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.password=123456
spring.datasource.username=root
spring.datasource.url=jdbc:mysql://localhost:3306/how2java?serverTimezone=GMT%2B8 

 

posted on 2020-06-30 23:44  SilenceAries  阅读(437)  评论(0)    收藏  举报

导航