Server returns invalid timezone. Need to set 'serverTimezone' property.

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

 

原因是MySQL驱动中默认时区是UTC,与本地时间(中国)相差八个小时,所以链接不上。
两种方法解决时区问题:

1.点开最右侧 Advanced,找到 serverTimezone,在右侧value处填写 GMT,保存即可!(或填写 Asia/Shanghai)

测试:

 2.可以在url后添加:?serverTimezone=GMT

注:

GMT(Greenwich Mean Time):格林威治标准时间
UTC:世界标准时间
CST(China Standard Time):中国标准时间

GMT + 8 = UTC + 8 = CST

想了解更多,请查看:

https://www.jetbrains.com/help/idea/2020.3/connectivity-problems.html#write-to-the-team

posted @ 2021-02-28 12:42  江河湖泊  阅读(2176)  评论(0编辑  收藏  举报