Navicat 報 1130 - Host XXX is not allowed to connect to this MySQL server 錯誤提示的解決辦法

在這裏插入圖片描述

  1. 用Navicat Premium 11.1.13鏈接雲服務器的數據庫時報錯
    報錯緣由:此時的MySQL配置不支持遠程鏈接 。
  2. 登錄服務器,進入數據庫 mysql -uroot -p
use mysql;

select host from user where user='root';

在這裏插入圖片描述

update user set host = '%' where user ='root';

將localhost設置爲通配符%,localhost設置了「%」後即可以容許遠程訪問。mysql

‘localhost’ 指的是用戶開放的IP,能夠是’localhost’(僅本機訪問,至關於127.0.0.1),能夠是具體的’...’(具體某一IP),也能夠是 ‘%’ (全部IP都可訪問)sql

  • 刷新權限
flush privileges;

查看配置數據庫

select host from user where user='root';

在這裏插入圖片描述
完成後,就能夠鏈接成功了。bash

相關文章
相關標籤/搜索