解决连接mysql数据库出现Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server tim

这里写自定义目录标题

  • 解决连接mysql数据库出现Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone
    • 问题描述
    • 解决方案

解决连接mysql数据库出现Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value ‘Öйú±ê׼ʱ¼ä’ is unrecognized or represents more than one time zone

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)

问题描述

这主要就是jdbc连接时出现时区的问题

解决方案

再配置文件上加上serverTimezone=UTC即可
datasource:
url: jdbc:mysql://localhost:3306/student?serverTimezone=UTC

你可能感兴趣的:(mysql连接异常)