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的时区设置为我们系统时区,一般都是北京时区


即可成功连接

本文详细解析了在使用SpringBoot结合MySQL8.X版本时,因时区设置不当导致的连接失败问题。针对Theservertimezonevalue‘Öйú±ê׼ʱ¼ä’isunrecognizedorrepresentsmorethanonetimezone错误,提供了具体的解决方案,即调整MySQL时区为系统所在时区,如北京时区,以确保数据库连接正常。
1603

被折叠的 条评论
为什么被折叠?



