centos7中,mysql鏈接報錯:1130 - Host ‘118.111.111.111’ is not allowed to connect to this MariaDB server

客戶端鏈接報錯html

這個問題是由於用戶在數據庫服務器中的mysql數據庫中的user的表中沒有權限。mysql

解決步驟sql

一、鏈接服務器: mysql -u root -pshell

二、看當前全部數據庫:show databases;數據庫

三、進入mysql數據庫:use mysql;服務器

四、查看mysql數據庫中全部的表:show tables;測試

五、查看user表中的數據:select Host, User,Password from user;3d

上面localhost表示只容許本地鏈接,不能遠程鏈接htm

六、修改user表中的Hostblog

update user set Host='%' where User='root' and Host="localhost";

上面這樣改了後,會致使xshell本地鏈接看不到全部的數據庫,localhost才表示本地鏈接,參考:http://www.javashuo.com/article/p-xlchatlo-hs.html

七、最後刷新一下:flush privileges;

 

八、從新在Navicate中測試一下:

 

 

至此,問題解決。

相關文章
相關標籤/搜索