遠端連線伺服器上的MySQL資料庫出現1130錯誤的解決辦法
阿新 • • 發佈:2019-01-11
問題背景:
win2003servers系統,mysql5.0資料庫,
MySQL-Front連線工具(以下簡稱MF)
問題:通過MF連線資料庫,出現ERROR 1130 (HY000): Host ‘xxx.xxx.xxx.xxx’ is not allowed to connect to this MySQL server
查詢原因:
在伺服器上用MySQL的
進入MySQLCommand Line Client連線上MySQL
然後select host, user from user;
得到的結果裡的host只有“127.0.0.1”、“localhost”,
所以需要新增host為“%”或將localhost修改為“%”
**原因:出現這種情況是因為mysql伺服器出於安全考慮,預設只允許本地登入資料庫伺服器。**
解決辦法:
改mysql的user表,具體方法如下:
1、先用use mysql;進入名字為mysql的資料庫;
2、mysql>update user set host='%' where host='localhost' and user='root';
3、mysql>flush privileges;
4、使用查詢語句檢視是否修改過來:mysql>select host,user from user;
結果中若有,host為“%”的root使用者,即可重啟MySQL後直接在MF客戶端連線即可成功。