Friday, July 27, 2007

Reset root mysql password on Windows server

How to reset the mysql root password on Windows server::::

step 1) Stop the MySQL services if it is running on the Windows server, where you need to reset mysql root password, go to the Services manager:

Start Menu -> Control Panel -> Administrative Tools -> Services

step 2) Then find the MySQL service in the list, and stop it.

step 3) Instead of going to services through control panel, you can use the Task Manager to stop the mysql services forcefully.

Create a text file and place the following command within it on a single line:


SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPassword');

Save the file with any name. For example, the file will be C:\mysql-init.txt.

step 4) Open a console window to get to the DOS command prompt:

Start Menu -> Run -> cmd

We are assuming that you have installed MySQL to C:\mysql. If you have installed MySQL to another location, adjust the following commands accordingly.

step 5) At the DOS command prompt, execute this command:

C:\> C:\mysql\bin\mysqld-nt --init-file=C:\mysql-init.txt