目錄
問題描述
給用戶權限時不知道 弄錯了什麼,重新輸入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;