idea关联mysql时报时区错误

  • 2019 年 12 月 2 日
  • 筆記

Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone' property manually.

MySQL默认的时区是UTC时区,比北京时间晚8个小时,所以要修改mysql的时长。

Win+R进入Dos窗口(配置了MySql环境变量),输入:mysql -u root -p

输入密码,进入mysql。

输入:set global time_zone=’+8:00’;

再次连接成功:

当然方法不止这一种,这种方法也不是永久的,重启后就会失效。