问题描述:

intellij idea连接mysql数据库时报错:Server returns invalid timezone. Go to ‘Advanced’ tab and set ‘serverTimezon’

Server returns invalid timezone. Go to ‘Advanced‘ tab and set ‘serverTimezon‘

问题分析

该错误为时区错误,MySQL默认的时区是UTC时区,比北京时间晚8个小时。

解决

1、解决方法是在连接字符串后加?serverTimezone=Asia/Shanghai,如果前面有别的参数了,问号‘?’要替换为逻辑与‘&’,设置好时区之后即可正常连接。

Server returns invalid timezone. Go to ‘Advanced‘ tab and set ‘serverTimezon‘

2、或者在Advanced中将serverTimezone设置成Hongkong即可

Server returns invalid timezone. Go to ‘Advanced‘ tab and set ‘serverTimezon‘

此时再重新连接就可以了

Server returns invalid timezone. Go to ‘Advanced‘ tab and set ‘serverTimezon‘

 

相关文章: