mysql 设置时区 配置文件my.ini 报错

在运行程序时,出现报错:

异常信息为: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终端设置了时区:
mysql> show variables like '%time_zone%';

mysql> set global time_zone = ‘+8:00’;

于是发现错误解决了!!但是第二天又出现了同样的错误。原来是配置文件my.ini时区设置没有修改过来

my.ini文件在安装MySQL的目录下(每个人安装的目录不同)

神奇的是,我这个配置文件竟然没有default-time-zone这个配置。

于是自己手动添加:(我觉得放在utf8后面应该没问题)

保存后,发现MySQL登不上,出现问题:

unknow default-time-zone=‘+-8:00’

于是找了原因,是没有重启MySQL!

重启后,发现还是报原来的错误。我想可能是这条配置放的位置不对、于是放到了这里:

重启之后,成功了!

(如果原来配置有这个条目,直接改为东八区就行了,不需要添加。)

原创文章 30 获赞 34 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_41950078/article/details/104777453
今日推荐