java.sql.SQLException: The server time zone value:xx异常
- 经验分享
- 时间:2019-06-02 14:49
- 2820人已阅读
简介
错误信息:java.sql.SQLException: The server time zone value '�й���ʱ��' is unrecognized or represents more than one time z
🔔🔔🔔好消息!好消息!🔔🔔🔔
有需要的朋友👉:联系凯哥
错误信息:
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] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.16.jar:8.0.16] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[mysql-connector-java-8.0.16.jar:8.0.16] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[mysql-connector-java-8.0.16.jar:8.0.16] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) ~[mysql-connector-java-8.0.16.jar:8.0.16] at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76) ~[mysql-connector-java-8.0.16.jar:8.0.16]
根据提示,我们可以知道,这个有可能是应用mysql服务器的时差问题。
那么,我们就查看连接mysql的配置
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xdclass?useUnicode=true&characterEncoding=utf-8
在连接中添加:serverTimezone=UTC
但是,我们知道,北京所以东8区。所以修改为北京时间应该是:&serverTimezone=GMT%2B8