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

Tomcat - removing server info

Below are the steps to remove Tomcat Server Information 1. Make sure Tomcat is not running 2. Navigate to "Tomcat Installation"...