springboot 启动报错
ERROR c.a.druid.pool.DruidDataSource - create connection SQLException,
url: jdbc:mysql://127.0.0.1:3306/ds0?useUnicode=true&characterEncoding=utf8, errorCode 0, state 01S00
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.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
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 common frames omitted
解决方法:
将:url: jdbc:mysql://127.0.0.1:3306/ds0?useUnicode=true&characterEncoding=utf8
改为:
url: jdbc:mysql://127.0.0.1:3306/ds0?useUnicode=true&characterEncoding=utf8
&serverTimezone=UTC
原因