[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.

Pycharm连接MySQL,在默认的情况下会出现错误,如图。

[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up._第1张图片
错误提示:

[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.

主要是时区的问题导致的。

解决的方案:

将URL中内容更改成如下形式:? 前面的部分替换成你自己的。

jdbc:mysql://localhost:3306/youdatabasename?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC

[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up._第2张图片

你可能感兴趣的:(程序设计)