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

加了驱动还是报错?

dataSource.setUrl("jdbc:mysql://localhost:3306/root");
dataSource.setUsername("root");
dataSource.setPassword("root");
dataSource.setDriverClassName("com.mysql.jdbc.Driver");

三月 25, 2019 11:19:25 下午 com.alibaba.druid.pool.DruidDataSource error

严重: create connection SQLException, url: jdbc:mysql://localhost:3306/root, errorCode 0, state 01S00

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 com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1513)

at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1578)

at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2466)


正在回答

2 回答

好像是mysql的URL时区配置问题,URL后添加:

?serverTimezone=GMT%2B8

试试?

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

提供的这些信息, 看不出来哪里的问题, 建议把整个代码贴一下

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

举报

0/150
提交
取消

加了驱动还是报错?

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