解决pycharm连接mysql报错:You must configure either the server or JDBC driver (via the 'serverTimezone


一:修改my.ini文件

方式一:

[mysqld] 下面添加  

  default-time-zone='+8:00'
  set global time_zone=’+8:00’

  #serverTimezone=Asia/Shanghai
  #set global time_zone=Asia/Shanghai

方式二:命令配置

二、pycharm的url设置 jdbc:mysql://localhost:3306/mysql?serverTimezone=Asia/Shanghai

三、连接成功

四、查询数据成功