Pages

Friday, July 19, 2013

How to reset Mysql root pasword on Windows


  1. Log on to your system as Administrator.

  2. Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager: From the Start menu, select Control Panel, then Administrative Tools, then Services. Find the MySQL service in the list and stop it.
    If your server is not running as a service, you may need to use the Task Manager to force it to stop.

  3. Create a text file containing the following statements. Replace the password with the password that you want to use.
    UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
    WHERE User='root';
    FLUSH PRIVILEGES;

  4. Save the file. For this example, the file will be named C:\mysql-init.txt.

  5. Open a console window to get to the command prompt: From the Start menu, select Run, then enter cmd as the command to be run.


  6. Start the MySQL server with the special --init-file option (notice that the backslash in the option value is doubled):
C:\mysql\bin\mysqld-nt --init-file=C:\\mysql-init.txt


Operation complete ;)

Check here for Mysql documentation.