mysql,本地鏈接看到的數據庫不全,遠程鏈接看到的數據庫是完整的

xshell本地鏈接數據庫,show databases;html

下面只顯示了兩個數據庫,mysql數據庫看不到,問題緣由是:用戶沒有權限mysql

navicat遠程鏈接,比上面看到的數據庫多了不少,能看到mysql等數據庫linux

停掉mysql,重啓,mysqld_safe --skip-grant-tables,或者vi /etc/my.cnf,在[mysqld]段中加入 skip-grant-tablessql

從新打開一個ssh鏈接,對mysql數據庫的user表進行操做,建議用navicat進行操做。shell

select * from user;數據庫

若是已經存在了host爲localhost的記錄,則先刪除該記錄,delete from user where host='localhost';windows

建立新增權限的insert語句:選中一行或者多行,能夠快速建立插入或者更新的sql語句centos

粘貼並執行(下面密碼爲空)ssh

INSERT INTO `user` VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','','0','0','0','0','','');工具

也能夠寫爲:

INSERT INTO `user` VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','');

說明:%不包含localhost

關閉全部數據庫的鏈接,中止服務

啓動服務

xshell本地鏈接數據庫,密碼爲空(也能夠設置密碼,參考:http://www.javashuo.com/article/p-qxufwmyl-bn.html

展現了全部庫

 

參考:

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

https://www.cnblogs.com/UncleYong/p/10070400.html

 

mysql在windows(含客戶端工具)及linux(yum)環境下安裝

https://www.cnblogs.com/UncleYong/p/10739530.html

相關文章
相關標籤/搜索