我发现我的 phpmyadmin 无法使用我的 root 密码登录。所以我更新了密码如下:
# mysql
mysql> UPDATE user set authentication_string=password('secret') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
Run Code Online (Sandbox Code Playgroud)
这样做后,我尝试使用我的新 root 密码连接:
# sudo -u www-data mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
Run Code Online (Sandbox Code Playgroud)
我不明白为什么我仍然被拒绝。
mysql> show grants for 'root'@'localhost';
+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL …Run Code Online (Sandbox Code Playgroud) mysql ×1