連線mysql報錯1130
阿新 • • 發佈:2019-01-30
Navicat for mysql 1130錯誤 用Navicat連線遠端MYSQL,提示如下錯誤,我以為是自己的防火牆問題,但是關了,依然不行。
看解決方法吧
ERROR 1130: Host '192.168.1.3' is not allowed to connect to thisMySQL server
解決方法:
1。改表法。可能是你的帳號不允許從遠端登陸,只能在localhost。這個時候只要在localhost的那臺電腦,登入mysql後,更改"mysql" 資料庫裡的 "user" 表裡的 "host"項,從"localhost"改稱"%"
mysql -u root -pvmwaremysql>usemysql;mysql>update user set host = '%' where user ='root';mysql>select host, user from user;
2.授權法。例如,你想myuser使用mypassword從任何主機連線到mysql伺服器的話。
GRANT ALL PRIVILEGES ON *.* TO IDENTIFIED BY 'mypassword' WITHGRANT OPTION;
如果你想允許使用者myuser從ip為192.168.1.3的主機連線到mysql伺服器,並使用mypassword作為密碼
GRANT ALL PRIVILEGES ON *.* TO IDENTIFIED BY'mypassword' WITH GRANT OPTION;
方法二:
錯誤程式碼是1130,ERROR 1130: Host xxx.xxx.xxx.xxx is not allowed to connect to this MySQL server 是無法給遠端連線的使用者許可權問題
給使用者授權
我用的使用者是root 密碼123456
首選語法為:
Sql程式碼
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
示例:
Sql程式碼
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
執行完後,再
mysql:flush privileges;
重新整理一下許可權就可以了,不用重啟
完整操作:
開始->執行->cmd
cd\
cd mysql安裝目錄\bin
mysql -u root -p123456;
mysql GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
mysql flush privileges;