为了账号安全,请及时绑定邮箱和手机立即绑定

搞不出来啊

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.

Exception in thread "main" 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)

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

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

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

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

at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76)

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835)

at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455)

at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)

at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199)

at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)

at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)

at coom.imooc.DBUile.main(DBUile.java:29)

Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: 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 java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)

at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)

at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)

at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)

at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:132)

at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2243)

at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2267)

at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1319)

at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:966)

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825)

... 6 more


正在回答

4 回答

感觉是报时区错误吧

jdbc:mysql://localhost:3306/dbname?serverTimezone=UTC  
这样写试试看

1 回复 有任何疑惑可以回复我~
#1

我爱孙佳怡 提问者

你们咋都知道要换成这句啊,这个昨天困扰了我一下午
2019-05-27 回复 有任何疑惑可以回复我~
#2

qq_慕设计4252141

我换成这句就可以运行了,谢谢啦
2019-11-17 回复 有任何疑惑可以回复我~

我的也是这个问题,按楼上说了,对的!!!!?

0 回复 有任何疑惑可以回复我~

com.mysql.jdbc.Driver  改为  com.mysql.cj.jdbc.Driver 时区的问题,但是好像有多种修改办法

0 回复 有任何疑惑可以回复我~

Exception in thread "main" 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.

这个异常提示说了是时区的问题。

另外:最好将com.mysql.jdbc.Driver  改为  com.mysql.cj.jdbc.Driver

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

搞不出来啊

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信