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

时间:2021-09-30 15:51:52

解决: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()