Reset MySQL Root Password in Windows

December 31, 2015 by Linux Guru

Filed under Database, MySQL, Window

Last modified July 15, 2016

Reset MySQL Root Password in Windows

1] Log in to your system as the “Administrator” user created in Windows setup.

2] Stop the MySQL service by clicking “Start,” “Control Panel,” “Administrative Tools,” “Services.” Scroll down to “MySQL.” Click “Stop.”

3] Open Notepad from the Start menu and enter the text: “UPDATE mysql.user SET Password=PASSWORD(‘MyNewPass’) WHERE User=’root.’

4] Save the file to an easily accessed location on your hard drive, such as C:\mysql.txt.

5] Open a new console by clicking “Start” then typing “CMD” in the search bar. Press “Enter.”

6] Start the mysql server with an initialization file. Enter the command “C:\mysql\bin\mysqld –init-file=C:\\mysql.txt” without quotes. The first term is the location and should be replaced with the location of mysqld, while the second term is the location of the file you created in Step 3.

7] Delete the reset password file that you saved in Step 3.

8] Open the Services window as you did in Step 2, changing “Stop” to “Start.” You can now connect to the MySQL server with the new password for your root account.

Leave a Comment