解決MySql報錯:1130 - Host ‘xxx‘ is not allowed to connect to this MySQL server的方法
發現問題
使用Navicat連線MySql資料庫時,未能成功,提示資訊如下圖:
解決辦法
.我們遠端聯接到MySql伺服器,開啟伺服器本地Navicat軟體,在查詢編輯器中執行下面的SQL語句
#查詢允許連線的主機及使用者資訊
select Host,User from mysql.user;
結果如下圖:
從結果中可以看到,MySql只允許使用root使用者從localhost,127.0.0.1和::1主機上進行連線,也就是隻能從本機連線。
注:::1 是Ipv6地址127.0.0.1的縮寫,也就是本機。
我們使用SQL語句將::1改為%,
update mysql.user set `Host` = '%' where User = 'root';
執行結果:
update mysql.user set `Host` = '%' where User = 'root';
受影響的行: 1
時間: 0.000ms
可以看到,已經將::1改為了%,%表示匹配所有host的主機的,開放此許可權,會增加MySql的風險,請根據實際情況而定!
執行下面的SQL,使上面的改動生效,否則仍然聯接不上
flush privileges;
執行結果如下:
[SQL]
flush privileges;
受影響的行: 0
時間: 0.003ms
此時,我們再用Navicat連線MySql伺服器,提示成功,如下圖:
補充
如果你想允許使用者root從ip為192.168.0.8的主機連線到MySql伺服器,並使用123456作為密碼,可以執行下面的SQL語句:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.0.8' IDENTIFIED BY '123456' WITH GRANT OPTION;
#執行下面的語句,使上面的改動生效
FLUSH PRIVILEGES;
相關文章
- Host 'xxx' is not allowed to connect to this MySQL server 解決方法MySqlServer
- 解決mysql Navicat 出錯:1130-host . is not allowed to connect to this MySql server,MySqlServer
- MySQL-1130-host ... is not allowed to connect to this MySql serverMySqlServer
- Host 'xxx' is not allowed to connect to this MySQL server.MySqlServer
- SQL Error (1130): Host IP is not allowed to connect to this MySQL serverErrorMySqlServer
- “Host ‘xxxx‘ is not allowed to connect to this MySQL server“MySqlServer
- Host is not allowed to connect to this MySQL server 錯誤的處理方法MySqlServer
- Navicat連線centos裡mysql報錯Host is not allowed to connect to this MySQL serverCentOSMySqlServer
- 報錯:1130-host ... is not allowed to connect to this MySql server 開放mysql遠端連線 不使用localhostMySqlServerlocalhost
- Host 'localhost' is not allowed to connect to this MySQL serverlocalhostMySqlServer
- mysql遠端連線 Host * is not allowed to connect to this MySQL serverMySqlServer
- 關於對連線資料庫時出現1130-host “**” is not allowed to connect to this MySql/mariadb server 的錯誤解決方法資料庫MySqlServer
- 上手MySQL之解決問題:not allowed to connect to this MySQL serverMySqlServer
- 虛擬機器NAT模式下連線mysql報錯:Host '192.168.30.1' is not allowed to connect to this MySQL server虛擬機模式MySqlServer
- ERROR 1130: Host ***.***.***.*** is not allowed to connect to this MySQL serverERROR 1062 (23000):ErrorMySqlServer
- navicat無法連線遠端的mysql--Host ‘xx.xx.xx.xx‘ is not allowed to connect to this MySQL server“MySqlServer
- Xtrabackup備份報錯Failed to connect to MySQL serverAIMySqlServer
- 【linux】Can't connect to MySQL server on 'XXX' (13)問題解決方式LinuxMySqlServer
- MySQL 中出現報錯提示: ‘Variable ‘XXX‘ is a read only variable‘的解決方法MySql
- 連線mysql報錯lost connect to sever during query解決MySql
- MySQL問題記錄--Can't connect to MySQL server on localhost (10061)解決方法MySqlServerlocalhost
- Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)解決方法MySqlServer
- mysql 啟動報錯Can't connect to local MySQL server through socket '/data/mysql/mysql/mysql.sock'(111)MySqlServer
- Linux環境下MySQL報Table 'xxx' doesn't exist錯誤解決方法LinuxMySql
- MySQL 5.5 關閉資料庫報錯"Can't connect to local MySQL server through socket"MySql資料庫Server
- 解決Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2) "MySqlServer
- 解決MySQL server has gone away錯誤的解決方案MySqlServerGo
- MySQL報錯'ERROR 2002 (HY000): Can't connect to local MySQL server through'MySqlErrorServer
- Mysql host is blocked because of many connection errors;unblock解決方法MySqlBloCError
- MySQL報錯:Packets larger than max_allowed_packet are not allMySql
- Can't Connect to MySQL Server on IP Address (10061) 錯誤的解決方案MySqlServer
- 連線MySQL錯誤:Can't connect to MySQL server (10060)MySqlServer
- ERROR 2002 (HY000): Cant connect to local MySQL server through socket的解決方法ErrorMySqlServer
- Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock錯誤MySqlServer
- Check_icmp check_host_alive報錯解決方法
- MySQL could not be resolved: Temporary failure in name resolution報錯解決方法MySqlAI
- MySQL server has gone away 問題的解決方法MySqlServerGo
- MYSQL中 TYPE=MyISAM 錯誤的解決方法MySql