Reset MySQL root password – running on Windows 7

I was playing around with installation of PHP, MySQL on my Windows 7 and for some reason I have forgotten my MySQL password. This is not that bad as it looks. There is a simple procedure how to reset the password and get the control back.

  1. Go to START / CONTROL PANEL and click on System and Security
  2. Click on Administrative Tools and select Services
  3. Scroll down and stop
    MYSQL service
  4. Now go to START / ALL PROGRAMS / ACCESSORIES
    and right click on Command PromptSelect RUN as Administrator
  5. Repeat it so you have two Command prompt windows running on your desktop
  6. In each of the Command prompt windows navigate to C:Program FilesMysqlMysql server 5.1bin>
  7. In first Command prompt window type: mysqld.exe –skip-grant-tables and pressENTER
  8. Go to second Command prompt window and type: mysql.exe –u root mysql and pressENTER, you should be granted access and be in mysql> prompt
  9. Now while at the mysql> type here UPDATE mysql.user SET Password=PASSWORD(‘new password’) WHERE User=’root’ and press ENTER
  10. If everything worked, you should receive QUERY OK
  11. Now type FLUSH PRIVILLEGES; and press ENTER, you will receive another Query OK
  12. Now you have to just reboot your machine and once you are back you should be able to log on with your new password J

4 Replies to “Reset MySQL root password – running on Windows 7”

Leave a Reply