The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone

mysql8.X版本 The server time zone value ‘Öйú±ê׼ʱ¼ä’ is unrecognized or represents more than one time zone问题

最近在学习springboot的时候用到了mysql,但在命令行能连接上的mysql,在idea中怎么都连不上,具体错误信息如下

java.lang.RuntimeException: 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.NativePro... (show balloon)

这个是时区的问题,貌似是mysql版本更新后才有的,版本5貌似是没有的,需要把mysql的时区设置为我们系统时区,一般都是北京时区

The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone_第1张图片
在这里插入图片描述

即可成功连接
The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone_第2张图片

你可能感兴趣的:(Mysql)