python settings :RROR 1130: Host 'XXXXXX' is not allowed to connect to this MySQL server

时间:2023-03-09 17:02:40
python settings :RROR 1130: Host 'XXXXXX' is not allowed to connect to this MySQL server

pymysql.err.InternalError: (1130, u"Host '127.0.0.1' is not allowed to connect to this MySQL server")

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

注:输入这段指令并回车后允许所有用root用户并且输入“123456”密码的主机登入该mysql Server,如果将'%'换成一个IP地址的话,那么只有该具有该IP地址的主机可以以root connect 到MYSQL Server