ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'--mysql报错

Centos 7 下的,使用yum 安装的mysql5.6 操作数据库时遇到对应问题,解决步骤

1.关闭mysql

service mysqld stop

2.屏蔽权限

mysqld_safe --skip-grant-table

屏幕出现: mysql .....

3.新开起一个终端输入

mysql -u root mysql

mysql> delete from user where USER='';

mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误

mysql> \q

你可能感兴趣的:(ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'--mysql报错)