1、pymysql.err.OperationalError: (2003, “Can’t connect to MySQL server on ‘localhost’ ([Errno 111] Connection refused)”)

解决:MySQL> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION;
MySQL> flush privileges;

 

最终解决方法为 新建用户 增加 权限

#db = pymysql.connect(HOST, PORT, USER, PASSWD, DB , charset='utf8')
db = pymysql.connect(host=HOST, user=USER, password=PASSWD, database=None,port=65535,db=DB, charset='utf8')
cur = db.cursor()

posted on 2019-04-08 09:45  Zhearts  阅读(9116)  评论(0编辑  收藏  举报

导航