当前位置: 代码迷 >> 综合 >> 连接MySQL数据库报错The server time zone value ‘?й???????‘ is unrecognized or represemore than one time zone
  详细解决方案

连接MySQL数据库报错The server time zone value ‘?й???????‘ is unrecognized or represemore than one time zone

热度:31   发布时间:2023-12-10 11:56:19.0

连接MySQL报了一个时区的错误: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.

第一种方法

首先查看mysql的当前时区

使用的是系统时区,我们改为东八区,修改my.ini配置文件,加入

default-time_zone = '+8:00'

重启MySQL服务,再次查看time_zone

第二种方法

去datasource配置文件,加上:&serverTimezone=UTC

spring.datasource.url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC

 

  相关解决方案