解決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-1130-host ... is not allowed to connect to this MySql serverMySqlServer
- Host 'xxx' is not allowed to connect to this MySQL server.MySqlServer
- Host 'localhost' is not allowed to connect to this MySQL serverlocalhostMySqlServer
- “Host ‘xxxx‘ 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/mariadb server 的錯誤解決方法資料庫MySqlServer
- 虛擬機器NAT模式下連線mysql報錯:Host '192.168.30.1' is not allowed to connect to this MySQL server虛擬機模式MySqlServer
- 上手MySQL之解決問題:not allowed to connect to this MySQL serverMySqlServer
- navicat無法連線遠端的mysql--Host ‘xx.xx.xx.xx‘ is not allowed to connect to this MySQL server“MySqlServer
- Can't Connect to MySQL Server on IP Address (10061) 錯誤的解決方案MySqlServer
- MySQL 中出現報錯提示: ‘Variable ‘XXX‘ is a read only variable‘的解決方法MySql
- 連線mysql報錯lost connect to sever during query解決MySql
- mysql 啟動報錯Can't connect to local MySQL server through socket '/data/mysql/mysql/mysql.sock'(111)MySqlServer
- MySQL 2003 - Can’t connect to MySQL server on (10060)MySqlServer
- Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock錯誤MySqlServer
- 解決MySQL server has gone away錯誤的解決方案MySqlServerGo
- Mysql host is blocked because of many connection errors;unblock解決方法MySqlBloCError
- Mysql mysql lost connection to server during query 問題解決方法MySqlServer
- mysql登入報錯提示:ERROR 1045 (28000)的解決方法MySqlError
- 連線mysql時提示is not allowed to connect不允許連線MySql
- MySQL報錯:Packets larger than max_allowed_packet are not allMySql
- MYSQL中 TYPE=MyISAM 錯誤的解決方法MySql
- 【問題解決】java.sql.SQLException: null, message from server: “Host ‘xxx.xx.xx.xxx‘ is blocked because ofJavaSQLExceptionNullServerBloC
- linux下連線mysql報錯ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysqLinuxMySqlErrorServer
- mysql 1130 問題MySql
- SQLyog連線MySQL8.0報2058錯誤的完美解決方法MySql
- mysql匯入報錯怎麼解決?MySql
- Navicat 連線 MySQL 失敗:2002-can‘t connect to server on localhost(10061)問題解決MySqlServerlocalhost
- mysql 發生系統錯誤1067的解決方法MySql
- 搭建 docker registry 私有倉庫並解決報錯Get https://xxx.xxx.xxx.xxx:5000/v1/_ping: http: server gave HTTP respDockerHTTPServer
- Mysql 錯誤日誌出現大量[Warning] Aborted connection to db user host的解決思路MySql
- ubuntu apt-get install xxx報錯無法下載的解決方法Ubuntuapt-get
- DBeaver、Navicat、MySQL高頻報錯及解決方法,此文持續更新MySql
- MySQL報錯ERROR 2013 (HY000): Lost connection to MySQL server during queryMySqlErrorServer
- Mysql 報Row size too large 65535解決方法MySql
- java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed 報錯的解決方案JavaSQLException
- Percona Toolkit工具連線MySQL 8報錯的解決方案MySql