简体   繁体   中英

MySQL/phpMyAdmin Reset ROOT PASSWORD?

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.

  • How to SAFELY reset the MySQL root password? (I have root account on O/S)

From Here: 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.

Connect to the mysqld server with this command:

shell> 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;

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

WINDOWS USERS

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;

-> mysql UPDATE mysql.user SET Password=PASSWORD('xvpaic7q') -> WHERE User='root'

-> FLUSH PRIVILEGES

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM