MySQL |无法使用root @ localhost登录,访问被拒绝

时间:2014-09-22 01:32:54

标签: mysql

我想我被卡住了。让MySQL服务器运行得很好,突然间我失去了对它的访问权限。它给出了错误

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

此外,我无法通过phpmyadmin登录(密码错误)。

我设法使用skip-grant-tables选项登录并查看正在进行的操作。这是mysql.user表:

| user | host +------+--------- | root | 127.0.0.1 | root | 195.14.50.18 | root | dlink-A9592D|

此外,SELECT PASSWORD=('my password here')提供与users表中相同的哈希值。

我做错了什么?一切看起来都是正确的,除非我无法使用正确的密码登录。

我已经尝试使用新密码更新用户(即使是空的,仍然无法正常工作)。无法在类似的主题中找到答案,所以我再次在这里问。

UPD。试图完全删除mysql并重新安装它。这里有一些魔力:

In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here.
Enter current password for root (enter for none): ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password : YES)

使用任何密码(空白,旧,任何其他)

1 个答案:

答案 0 :(得分:0)

对我有用的解决方案:
1.使用my.cnf中包含的skip-grant-tables重新启动mysql;
2.放弃所有用户;
3.创建新用户并授予所有权限

相关问题