MySQL问题:Access denied for user 'mysql'@'localhost'

Posted 橘个栗子

tags:

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

[email protected]:~$ sudo mysql -uroot -p

mysql> update mysql.user set authentication_string=PASSWORD(mysql), plugin=mysql_native_password where user=root;
Query OK, 1 row affected, 1 warning (0.04 sec)
Rows matched: 1  Changed: 1  Warnings: 1

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[email protected]-PC:~$ sudo service mysql restart

 [email protected]:~$ mysql -uroot -p

 

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

Access denied for user ''@'localhost' to database 'mysql'问题

MySql access denied for user错误

启用远程 MySQL 连接:ERROR 1045 (28000): Access denied for user

Ubuntu 18 mysql数据库登陆报错“Access denied for user”

Mysql Access denied for user 'root'

MySQL Access denied for user root@localhost 解决方法