目录
问题描述
给用户权限时不知道 弄错了什么,重新输入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;