mysql8 连接报错:Caused by: java.sql.SOLException: The server time zone value ‘PDT’is unrecognized or rep

问题现象如图:

 具体报错信息:

Caused by: java.sql.SOLException: The server time zone value 'PDT’is unrecognized or represents more than one time zone. You must c
onfiaure either the server or jdbc driver (via the serverTimezone confiauration propertv) 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.ciidbc.exceptions.solError.createSoLException(SOLError.java:97 at com.mysql.cj.jdbc.exceptions.sQLError.createsQLException(SQLErrorjava:89) at com.mysql.cj.jdbc.exceptions.sQLError.createSQLException(SQLError.java:63) at com.mysql.cj.jdbc.exceptions.soLError.createSoLException(SOLError.java;73)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76) at com.mysql.cj.jdbc.ConnectionImpl.createNewIoConnectionImpljava:835) at com.mysql.ci.idbc.ConnectionImpl.<init>(ConnectionImpljava:455)

问题原因:

我的连接字符串是这样写的:

没有指定时区情况,加上serverTimeZone即可:

 最终连接字符串信息为:

driver-class-name: com.mysql.cj.jdbc.Driver 
url: idbc:mysql://192.168.214.173:3306/xxx?- 
useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimeZone=UTC
username: xxx
password:xxx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值