(已解決) MySQL: ERROR 1045 (28000): Access denied for user 'xxxxx'@'localhost' (using password: NO)

目錄

問題描述 

解決辦法:

1.登錄到root

 2. 查詢用戶名

3. 找到自己的user和host刪除

解決done


問題描述 

給用戶權限時不知道 弄錯了什麼,重新輸入mysql命令時報錯:

ERROR 1045 (28000): Access denied for user 'xxxxx'@'localhost' (using password: NO)

解決辦法:

1.登錄到root

mysql -uroot -p 

 2. 查詢用戶名

use mysql

select host,user,plugin,authentication_string from user;
(如果是5.7版本之前的,使用語句:select host,user,plugin,password from user;)

3. 找到自己的user和host刪除

delete from user where user='XXX' and host='localhost';其中XXX爲用戶名,localhost爲主機名。

4.使生效

flush privileges;

解決done

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