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.

今天在使用jdbc连接本地mysql数据库时,报出以下错误:

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.

译文:服务器时区价值”Oйu±e×¼e±¼的识别或代表多个时区。如果希望利用时区支持,必须配置服务器或JDBC驱动程序(通过serverTimezone配置属性)以使用更特殊的时区值。


at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

解决方法:在jdbc连接后面加上如下标注参数

jdbc:mysql://localhost:3306/auto_db?serverTimezone=UTC

237 Clicks !