问题现象如图:
具体报错信息:
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