本文介绍了MySQL/phpMyAdmin重置根密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在RHEL上具有MySQL,并且还具有phpMyAdmin接口.我可以记住普通的MySQL用户访问权限,但忘记了root密码.

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.

  • 如何安全地重置MySQL root密码? (我在操作系统上有root个帐户)
  • How to SAFELY reset the MySQL root password? (I have root account on O/S)

推荐答案

从此处: http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

停止mysqld并使用--skip-grant-tables选项重新启动它.这样一来,任何人都无需密码就可以使用所有特权进行连接.因为这是不安全的,所以您可能希望将--skip-grant-tables与--skip-networking结合使用,以防止远程客户端连接.

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服务器:

Connect to the mysqld server with this command:

shell> mysql

在mysql客户端中发出以下语句.将密码替换为您要使用的密码.

Issue the following statements in the mysql client. Replace the password with the password that you want to use.

mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
    ->                   WHERE User='root';
mysql> FLUSH PRIVILEGES;

FLUSH语句告诉服务器将授权表重新加载到内存中,以便它注意到密码更改

The FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change

这篇关于MySQL/phpMyAdmin重置根密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 19:16