PyCharm中配置MySQL出现Server returns invalid timezone问题解决方法

Image

PyCharm中配置MySQL出现Server returns invalid timezone问题解决方法

系统环境

  • Windows10 64位系统
  • MySQL版本为8.0.20
  • PyCharm版本为专业版2020.1

原因:

首先,出现该问题的原因是MySQL驱动jar中的默认时区是UTC。

UTC代表的是全球标准时间 ,但是我们使用的时间是北京时区也就是东八区,领先UTC八个小时。

因为时区不一致,所以提示Server returns invalid timezone. Need to set 'serverTimezone' property.
服务器返回了无效的时区,点击Set time zone手工设置“serverTimezon"属性值。

Image

两种解决方案:

方案一:

在mysql的命令模式下,输入:

SET GLOBAL time_zone = '+8:00';

在MySql命令行上解决了该问题,效果如图:

Image

方案二:

手工设置“serverTimezon"属性值为 Asia/Shanghai

Image

参考链接

  • https://blog.csdn.net/ITMan2017/article/details/100601438
  • https://stackoverflow.com/questions/57665645/server-returns-invalid-timezone-go-to-advanced-tab-and-set-servertimezone-prope

你可能感兴趣的:(PyCharm中配置MySQL出现Server returns invalid timezone问题解决方法)