无法更改MySQL密码
我安装了MySQL,安装需要密码。我不想输入一个,但我必须单击“下一步”并完成安装。
所以,我试图改变它。
在 cmd 提示符中:
C:\>mysql -u root -p
Enter password: **
mysql> use mysql;
Database changed
mysql> select `password` from `user` where `user` = 'root';
返回一个空密码字段。但是当我执行 mysql -u root 时,我收到访问被拒绝错误,然后我执行 mysql -u root -p 并要求输入密码,我按 Enter 键,我被拒绝访问。所以我重复上面的代码块中的内容,并且发生了同样的事情。
I installed MySQL, and the installation requires a password. I didn't want to enter one, but I had to to click "Next" and finish the installation.
So, I tried to change it.
In the cmd prompt:
C:\>mysql -u root -p
Enter password: **
mysql> use mysql;
Database changed
mysql> select `password` from `user` where `user` = 'root';
That returns an empty password field. But when I do mysql -u root
I get the access denied error, and then I do mysql -u root -p
and it asks for a password, I press enter, and I get denied access. So I repeat what's in the code block above, and the same thing happens.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据MySQL的文档如何重置Root密码 :
According to MySQL's documentation on How to Reset the Root Password:
试试这个
在命令提示符下,
输入以下内容:
mysqladmin -u root(假设您的用户名是“root”)
点击回车按钮,然后它会显示执行一些东西的命令。
更改密码
输入以下内容;
mysqladmin -u root 密码
然后它会要求输入新密码
输入您的新密码,即您要使用的密码。按回车键,它会再次请求它。输入它并按回车键。
就是这样,您的密码已更改
现在您可以检查状态
输入:
mysqladmin -u root -p status
它说,输入密码,
使用您的新密码
希望有帮助
Try this
In your command prompt,
Type the following :
mysqladmin -u root (assuming that ur username is "root")
Hit enter button, then it will show you commands to execute some stuffs.
for password change
Type the following ;
mysqladmin -u root password
It will then ask for new password
Enter ur new password , that is, the password you wish to use. Hit enter, it will request it again. Enter it and hit enter.
That is it, your password is changed
Now you can check the status
Type:
mysqladmin -u root -p status
It says, enter password ,
Use your new password
I hope it helps