idea连接mysql报错:Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone'

前言

在项目开发时,idea连接mysql数据库,密码输入错误次数过多,导致报如下错误:
Server returns invalid timezone. Go to ‘Advanced’ tab and set ‘serverTimezone’ property manually.
idea连接mysql报错:Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone'
然后我通过命令行进行试探以下,是否自己的密码错误:
idea连接mysql报错:Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone'
密码还是那个密码,在命令行是可以登录的,出现这种问题,叫我很纠结,查阅资料
根据报错:翻译过来就是:服务器返回无效时区。进入“高级”选项卡,手动设置“serverTimezone”属性。

 
 
解决办法:

查看其他博主的博客,说需要查看环境变量,然后我查看了以下我自己的环境变量:
参考博主地址:https://blog.****.net/liuqiker/article/details/102455077
idea连接mysql报错:Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone'

操作我们CMD命令行

输入 show variables like’%time_zone’; (注意不要漏掉后面的分号),回车,如图:
idea连接mysql报错:Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone'
显示 SYSTEM 就是没有设置时区啦。

设置时区:

输入set global time_zone = ‘+8:00’; 注意不要漏掉后面的分号),回车,如图:

idea连接mysql报错:Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone'

通过命令查看,

idea连接mysql报错:Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone'
时间没有修改成功,

时间没有修改成功,我使用IDEA进行操作

idea连接mysql报错:Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone'
竟然成功了,唉,不晓得,不过看其他博客的内容却是不错,大家可以参考以下看看

 
 
 
优秀博文:

https://blog.****.net/liuqiker/article/details/102455077