mysql 連線錯誤碼1130(not allowed to connect to this MySQL server)解決
阿新 • • 發佈:2021-12-11
1. win + R 輸入cmd
2.在安裝Mysql資料庫的主機上登入:
如 root使用者
輸入命令 mysql -u root -p
輸入密碼後
3.
use mysql;
注意:語句結束需要封號(;)
4.
select host from user where user = 'root';
注意:語句結束需要封號(;)
看查詢出來的host是否有需要連線本資料的ip地址
結果可能要兩種情況
>>1.只有localhost
將Host設定為萬用字元%
(%是個萬用字元,如果Host=127.0.1.%,那麼就表示只要是IP地址字首為“127.0.1.”的客戶端都可以連線。如果Host=%,表示所有IP都有連線許可權)
update user set host='%' where user='root';
>>2.除了localhost還有其它的ip
這時候修改其中一條即可(例如localhost)
update user set host='%' where user='root' and user = 'localhost';
5.最後重新整理一下:flush privileges;
就可以了