mysql - 是的,另一个 MySql : ERROR 1045 (28000): Access denied for user 'root' @'localhost' (using password: YES)

标签 mysql ruby-on-rails ruby

所以我不确定是什么原因导致我的 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/

相关文章:

php - 状态更改时使用订单数量更新产品数量的sql查询

php - 需要一个正则表达式来匹配不带前导 0 的十进制数字

ruby-on-rails - Carrierwave:如何上传大文件?

jquery - Ratyrate 星星未在生产中加载(heroku)

ruby - 需要 nokogiri : Load Error

mysql - 不小心以 root 用户身份安装了 phpmyadmin

php - 动态调整图像大小的 PHP 的内容长度

ruby-on-rails - 同时使用 has_one 和 has_many 关联

ruby - 选择性 Ruby 数组切片

ruby-on-rails - 以 Rails 形式处理 MongoMapper EmbeddedDocument