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

Posted 我是谁???

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'相关的知识,希望对你有一定的参考价值。

solution 1:
1.关闭mysql
   # service mysqld stop
2.屏蔽权限
   # mysqld_safe --skip-grant-tables 
3.新开起一个终端输入
   # mysql -u root mysql
   mysql>update mysql.user set authentication_string=password(\'123456\') where user=\'root\';
   mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误
   mysql>exit;

solution2:
1.关闭mysql
   # service mysqld stop
2.屏蔽权限
   # mysqld_safe --skip-grant-tables 
3.新开起一个终端输入
   # mysql -u root mysql
   mysql> delete from user where USER=\'\';
   mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误
   mysql> exit;

修改密码过程中,遇到如图所示的情况:

查看日志:

解决办法:

sudo service mysql status

 

sudo service mysql stop

 If you have issue stopping then do following

 Search for process: 

ps aux | grep mysqld

Kill the process:

 kill -9 process_id

Now start mysql in safe mode with skip grant

sudo mysqld_safe --skip-grant-tables 

 排除遇到的问题外,继续执行solution1或者solution2

以上是关于ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'的主要内容,如果未能解决你的问题,请参考以下文章

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

ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'ambari

[故障解决]Mysql爆出ERROR 1044 (42000)的错误怎么办?

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

解决 ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql&

ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'db'(示