![使用 MySQL 根密码访问被拒绝](https://linux22.com/image/1190583/%E4%BD%BF%E7%94%A8%20MySQL%20%E6%A0%B9%E5%AF%86%E7%A0%81%E8%AE%BF%E9%97%AE%E8%A2%AB%E6%8B%92%E7%BB%9D.png)
我在 Ubuntu 22.04 上安装 MySQL 时出错。
当我这样做su - mysql -u root
或su - mysql -u root
我得到Access denied for user 'root'@'localhost'
如何才能让它再次工作?
[1]+ Stopped mysql
root@ubuntu-instance1:~# sudo mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 16 Server version: 8.0.31-0ubuntu0.22.04.1 (Ubuntu)
mysql>
update user set plugin='' where User='root';
flush privileges;
Database changed
mysql>
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0**