1. 程式人生 > 其它 >Navicat連線錯誤1130:is not allowed to connect to this mysql server(親測有效)

Navicat連線錯誤1130:is not allowed to connect to this mysql server(親測有效)

使用Navicat連線遠端資料庫的時候,發生連線錯誤is not allowed to connect to this mysql server。

後來查了各種資料,就是連線的使用者沒有遠端訪問許可權。
處理辦法,給連線的使用者加上遠端訪問許可權。
以root使用者為例。

先在 mysql得bin目錄上得位址列中輸入cmd 回車

1.先登入到遠端倉庫的mysql。
mysql -u root -p


2.進入mysql資料庫。
use mysql;


3.檢視user表的host欄位
select host from user where user='root';

這些是允許訪問資料庫的地址。我們可以追加一條也可以直接將localhost改成%允許所有地址使用這個
使用者訪問。

4.更改host欄位允許遠端訪問
update user set host='%' where user = 'root' and host='localhost';

然後再檢視一下這個欄位的字
select host from user where user='root';

如圖所示說明修改成功。最後使用命令更新設定即可。

5.更新設定
flush privileges;

這樣重新使用navicat重新連線,就可以連線成功了。
————————————————
版權宣告:本文為CSDN博主「笑我歸無處」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處連結及本宣告。
原文連結:https://blog.csdn.net/qq_42068856/article/details/109293298