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

weixin_33935777發表於2018-04-25

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;
複製程式碼

相關文章