解决pycharm连接mysql报错:You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specifc time zone value if you want to utilize time zone support.

一:修改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

 

 

 

 

 

三、连接成功

 

四、查询数据成功

 

posted @ 2021-12-22 14:35  hecity  阅读(188)  评论(0编辑  收藏  举报