java.sql.SQLException: The server time zone value ‘锟叫癸拷锟斤拷准时锟斤拷‘ is unrecognized or represents more

16:27:34.579 ERROR --- [ionPool-Create-1016856028] com.alibaba.druid.pool.DruidDataSource   : create connection SQLException, url: jdbc:mysql://127.0.0.1:3306/seata?useUnicode=true&rewriteBatchedStatements=true, 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) ~[na:na]
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[na:na]
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[na:na]
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[na:na]
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) ~[na:na]
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76) ~[na:na]
        at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) ~[na:na]
        at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:456) ~[na:na]
        at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) ~[na:na]
        at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197) ~[na:na]
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644) ~[druid-1.1.23.jar:1.1.23]
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710) ~[druid-1.1.23.jar:1.1.23]
        at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774) ~[druid-1.1.23.jar:1.1.23]
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 sun.reflect.GeneratedConstructorAccessor26.newInstance(Unknown Source) ~[na:na]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_372]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_372]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[na:na]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85) ~[na:na]
        at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:132) ~[na:na]
        at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2118) ~[na:na]
        at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2142) ~[na:na]
        at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1310) ~[na:na]
        at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:967) ~[na:na]
        at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826) ~[na:na]
        ... 6 common frames omitted

这个错误是由于MySQL连接时区设置不正确导致的。你可以通过在JDBC连接字符串中添加serverTimezone参数来指定时区。

北京等沿海地区时区设置为中国标准时间,也称为东八区(UTC+8)。因此,如果你使用MySQL数据库并且服务器部署在沿海等地区,你可以将JDBC连接字符串中的serverTimezone参数直接设置为"GMT+8"来表示时区设置。

然后就是成功启动了:

java.sql.SQLException: The server time zone value ‘锟叫癸拷锟斤拷准时锟斤拷‘ is unrecognized or represents more_第1张图片

你可能感兴趣的:(异常系列,开发语言,java,seata,mysql时区错误,异常系列)