MySQL 忘记mysql root密码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10879476/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Forgot mysql root password
提问by Om3ga
I forgot mysql root password. How can I get it again? I am trying to use mysql -u root
command but I am getting this error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
我忘记了 mysql root 密码。我怎样才能再次得到它?我正在尝试使用mysql -u root
命令,但出现此错误ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
how can I solve this problem?
我怎么解决这个问题?
回答by Rahul
Try with -p
option; then it will prompt you for password. In your case, it's saying that you can't access with user root with no password.
尝试-p
选项;然后它会提示你输入密码。在您的情况下,它是说您无法使用没有密码的用户 root 访问。
mysql -u root -h localhost -p
In case, you have really forgot your password then take a look here on how to reset the same
如果您真的忘记了密码,请在此处查看如何重置密码
How to Reset the Root Password(for 5.7 version)
如何重置root密码(5.7版本)