我在 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**