not allowed to connect to this MySQL server

  1. 在用Navicat配置遠程連接Mysql數據庫時遇到如下報錯信息,這是由於Mysql配置了不支持遠程連接引起的。

    not allowed to connect to this MySQL server

  2. 在安裝Mysql數據庫的主機上登錄root用戶:

    mysql -u root -p

    not allowed to connect to this MySQL server

  3. 依次執行如下命令:

    use mysq;

    select host from user where user='root';

    可以看到當前主機配置信息爲localhost.

    not allowed to connect to this MySQL server

  4. 執行update user set host = '%' where user ='root'將Host設置爲通配符%。

    Host設置了“%”後便可以允許遠程訪問。

    not allowed to connect to this MySQL server

    not allowed to connect to this MySQL server

  5. Host修改完成後記得執行flush privileges使配置立即生效。

    not allowed to connect to this MySQL server

  6. 完成以上操作後,再試嘗試遠程連接Mysql,報錯信息消失。如果再次連接出現2059報錯信息,可以參考以下經驗解決。

    4如何修復mysql 8.0.11連接報錯2059?

    not allowed to connect to this MySQL server

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章