所以我不确定是什么原因导致我的 MySql 密码困惑(升级到 Mountain Lion,重新安装 ruby/rails(其他问题),或者只是运气不好)但我们在这里:
登录mysql没问题,但是我root不了
Ayman$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 96
Server version: 5.5.25 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
当我尝试登录到 root 时:
Ayman$ mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
查看用户:
mysql> CREATE USER root@localhost IDENTIFIED BY 'out22out';
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
mysql> SELECT USER(),CURRENT_USER();
+-----------------+----------------+
| USER() | CURRENT_USER() |
+-----------------+----------------+
| Ayman@localhost | @localhost |
+-----------------+----------------+
1 row in set (0.00 sec)
mysql> SELECT USER, HOST FROM mysql.user;
ERROR 1142 (42000): SELECT command denied to user ''@'localhost' for table 'user'
mysql> select user, host from mysql.user;
ERROR 1142 (42000): SELECT command denied to user ''@'localhost' for table 'user'
mysql> grant all on *.* to Ayman@'%';
ERROR 1045 (28000): Access denied for user ''@'localhost' (using password: NO)
mysql>
我已经尝试重新安装 MySql(不确定如何卸载它)、停止服务器实例并重新启动它,以及对右侧无数类似问题的所有其他建议。我已经用了 3 天了,这让我很痛苦。
有什么线索吗?
最佳答案
您可以 start MySQL (服务器,而不是命令行监视器)使用 --skip-grant-tables
,它会暂时关闭权限系统。这会让你进入,更新你的帐户/密码,而不会妨碍那些搞砸的权限。问题修复后,您可以执行 flush privileges;
以重新启用权限系统。
关于mysql - 是的,另一个 MySql : ERROR 1045 (28000): Access denied for user 'root' @'localhost' (using password: YES),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12085022/