Sunday, November 15, 2009

MySQL - Resetting Root Password

Sometime, you may forget the root password of MySQL. Below is some extracted steps to reset the root's password in Windows

1. Stop running MySQL instance. net stop mysql
2. Save the following to a text file where MyNewPass is your desired root's new password. In this example, this file will be saved at MySQL installed home's bin folder and the file calls "reset_password.txt"

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

3. Go to your mysql install home and run this command

mysqld-nt.exe --defaults-file="C:\Program Files\MySQL\MySQL Server 5.0\my.ini" --init-file="C:\Program Files\MySQL\MySQL Server 5.0\bin\reset_password.txt" --console

4. If MySQL start correctly, stop the server by Ctrl-C.
5. Restart the MySQL as a window service. net start mysql
6. Test your new password by mysql -u root -p. This command will prompt you for the password.

You can reset root's password for Linux too. Details can be found in

No comments:

Post a Comment

Windows 7 - STOP 0x0000007B (0xFFFFF880009A97E8 0xFFFFFFFFC0000034 0x0000000000 0x0000000000)

If you encounter STOP 0x0000007B (0xFFFFF880009A97E8 0xFFFFFFFFC0000034 0x0000000000 0x0000000000) blue screen of death. This is very like...