在我搞砸之前,当我使用$ mysql -u root -p
,登录并显示数据库时:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| game_data |
| test |
+--------------------+
Run Code Online (Sandbox Code Playgroud)
然后我尝试创建一个新用户并注意到 PRIVILEGES 有问题。
所以我删除了新用户,我想我不小心删除了“root”和“Admin”。
然后我尝试再次创建“root”,但是在授予所有权限时出现拒绝访问错误。
mysql> CREATE USER 'root'@'localhost' IDENTIFIED BY 'password';
mysql> grant all privileges on *.* to 'root'@'localhost' identified by 'password' with grant option;
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Run Code Online (Sandbox Code Playgroud)
如果我使用$ mysql -u root -p
,再次登录 MySQL并显示数据库,
+--------------------+
| Database |
+--------------------+
| information_schema …
Run Code Online (Sandbox Code Playgroud)