連接mysql服務器出現Host is not allowed to connect to this MySQL server解決方法

今天在自己的服務器上下載好mysql後發現本地連接報錯Host is not allowed to connect to this MySQL server

發現mysql不允許遠程登陸,解決辦法如下:

1.在服務器上登錄mysql :  mysql -u root -p 密碼

2.進入sql後執行 use mysql;

3.執行 update user set host = '%' where user = 'root';

4.執行 flush privileges;

執行完這4步後再次連接mysql服務器,就可以了。

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