Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value ‘

Posted 闲言_

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value ‘相关的知识,希望对你有一定的参考价值。

错误产生环境

Spring Boot 整合JDBC 时产生

错误描述

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) ~[na:1.8.0_101]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_101]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_101]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_101]

错误原因

  • 这是因为时区没有设置造成的
  • 因为Spring Boot 默认使用的是8版本的东西,所有会报这个异常

在这里插入图片描述

解决办法

在 连接上 添加以下内容

UTC科普

serverTimezone=UTC

在这里插入图片描述

以上是关于Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value ‘的主要内容,如果未能解决你的问题,请参考以下文章

Mathematical Problems Caused by CCD

Caused by SSLError

Caused by: java.lang.NoClassDefFoundError:

caused by a circular import.

异常Caused by: java.lang.ClassNotFoundException: org.springframework.dao.DataIntegrityViolationExcep

Caused by org hibernate DuplicateMappingException Duplicat