MySQL遠端訪問:錯誤碼1130解決方案
阿新 • • 發佈:2019-02-01
錯誤描述:
錯誤程式碼:1130
Host ***.***.***.*** is not allowed to connect to this MySQL server
解決方法:
①改表法:
可能是你的帳號不允許從遠端登陸,只能在localhost。這個時候只要在localhost的那臺電腦,登入mysql後,更改“mysql”資料庫裡的“user”表裡的“host”項,從“localhost”改稱”%”
mysql -u root -p
mysql>use mysql;
mysql>update user set host = ‘%' where user =’root’;
mysql>flush privileges;
mysql>select host,user from user where user=’root’;
現在就可以連線了!
②授權法
例如,你想root使用root從任何主機連線到mysql伺服器的話。
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
如果你想允許使用者root從ip為192.168.1.3的主機連線到mysql伺服器,並使用root作為密碼
GRANT ALL PRIVILEGES ON *.*
TO 'root'@'192.168.1.3' IDENTIFIED BY'root' WITH GRANT OPTION;