MySQL-1130-host ... is not allowed to connect to this MySql server

1、解决方式一:改表法

    ~ user mysql;
    ~ update user set host = '%' where user = 'root';
    ~ select host, user from user;
    ~ flush privileges;//刷新权限
复制代码

2、方法二:授权法

    //不限制IP
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION;
    flush privileges;
    //限制IP
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.2' IDENTIFIED BY 'password' WITH GRANT OPTION;
    flush privileges;
复制代码

你可能感兴趣的:(数据库)