当前位置: 代码迷 >> 综合 >> MySQL 数据库时区设置方法,“The server time zone value ‘?й???????‘ is unrecognized or represents ...” 问题解决
  详细解决方案

MySQL 数据库时区设置方法,“The server time zone value ‘?й???????‘ is unrecognized or represents ...” 问题解决

热度:92   发布时间:2023-12-12 05:11:38.0

连接 mysql 数据库时提示如下异常,是时区问题导致的。

An error occurred while establishing the connection:Long Message:
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.Details:Type: java.sql.SQLExceptionSQL State: 01S00

报错翻译:
服务器时区值 ‘?й???????’ 无法识别或表示多个时区。如果您想利用时区支持,您必须配置服务器或 JDBC 驱动程序(通过 ‘serverTimezone’ 配置属性)来使用更具体的时区值。

解决方法:
修改 my.ini 文件,加入时区设置 default-time_zone='+8:00' 即可,重启 mysql 服务生效。
在这里插入图片描述
不重启 mysql 服务临时生效可以这样设置
set global time_zone='+8:00';
flush privileges;
在这里插入图片描述
喜欢的点个赞?吧!

  相关解决方案