java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more

新版本数据库MySQL8.0.12出现:

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:127)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:87)

我们只需要在访问数据库的Url后面加上以下的语句即可:

?serverTimezone=GMT%2B8

比如,我原来的url是:

jdbc:mysql://localhost:3306/miaosha

修改为:

jdbc:mysql://localhost:3306/miaosha?serverTimezone=GMT%2B8

猜你喜欢

转载自blog.csdn.net/u011702479/article/details/82118113