无法将mysql密码重置为root [英] Cannot reset mysql password as root

查看:119
本文介绍了无法将mysql密码重置为root的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将CentOs与mysql 5版本一起使用,忘记了密码,但无法重置密码,

i am using CentOs with mysql 5 version, forgot my password, and i cannot reset it, what i did is

/etc/init.d/mysqld stop

mysqld_safe --skip-grant-tables &
mysql -u root

mysql>  update mysql.user set password=PASSWORD("pass") where User='root';

收到此消息

Query OK, 0 rows affected (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 0

mysql> flush privileges; exit;
Query OK, 0 rows affected (0.00 sec)

停止并启动mysql,但无论如何

Stopped and strated mysql but its anyway

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

我已经尝试过此解决方案 mysql官方网站,无论如何都无法正常工作.有什么建议吗?

i have tried this solution mysql official site, not working anyway. Any suggestions?

我的主要用户是admin而不是root,所以我现在更改了admin的密码已经可以了,对此感到抱歉.谢谢大家.

My main user was admin not root so i changed password for admin all is ok now, sorry for this. thanks everyone.

推荐答案

仔细查看您的错误消息:

Have a closer look at your error message:

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

您可能已经设置了一个新密码,但是您没有使用它来进行连接.

You might have set a new password, but you are not using it to connect.

这篇关于无法将mysql密码重置为root的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆