Linux MySQL/phpMyAdmin 重置根密码?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14703223/
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
MySQL/phpMyAdmin Reset ROOT PASSWORD?
提问by u775856
I'm having MySQL on RHEL, and phpMyAdmin interface also. I have normal MySQL user access which i remember but i forget the root
password.
我在 RHEL 上有 MySQL,还有 phpMyAdmin 界面。我有正常的 MySQL 用户访问权限,我记得但我忘记了root
密码。
- How to SAFELY reset the MySQL
root
password? (I haveroot
account on O/S)
- 如何安全地重置 MySQL
root
密码?(我root
在 O/S 上有账号)
采纳答案by FreudianSlip
From Here: http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
从这里:http: //dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
Stop mysqld and restart it with the --skip-grant-tables option. This enables anyone to connect without a password and with all privileges. Because this is insecure, you might want to use --skip-grant-tables in conjunction with --skip-networking to prevent remote clients from connecting.
停止 mysqld 并使用 --skip-grant-tables 选项重新启动它。这使任何人都可以在没有密码的情况下使用所有权限进行连接。由于这是不安全的,您可能希望将 --skip-grant-tables 与 --skip-networking 结合使用以防止远程客户端连接。
Connect to the mysqld server with this command:
使用以下命令连接到 mysqld 服务器:
shell> mysql
Issue the following statements in the mysql client. Replace the password with the password that you want to use.
在 mysql 客户端中发出以下语句。将密码替换为您要使用的密码。
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
-> WHERE User='root';
mysql> FLUSH PRIVILEGES;
The FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change
FLUSH 语句告诉服务器将授权表重新加载到内存中,以便它注意到密码更改
回答by numediaweb
WINDOWS USERS
WINDOWS 用户
For me in wondows 8 this worked;
First go to where you installed mysql, I was using wamserver and installed it under D:\Programs\wamp\bin\mysql\mysql5.6.12\bin
so cd
to that directory, then;
对我来说,在 windows 8 中这是有效的;首先进入你的mysql安装,我用wamserver下安装了它D:\Programs\wamp\bin\mysql\mysql5.6.12\bin
,以便cd
到该目录,然后;
-> mysql UPDATE mysql.user SET Password=PASSWORD('xvpaic7q') -> WHERE User='root'
-> FLUSH PRIVILEGES