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.
- Go to START / CONTROL PANEL and click on System and Security
- Click on Administrative Tools and select Services
- Scroll down and stop
- Now go to START / ALL PROGRAMS / ACCESSORIES
and right click on Command Prompt – Select RUN as Administrator
- Repeat it so you have two Command prompt windows running on your desktop
- In each of the Command prompt windows navigate to C:Program FilesMysqlMysql server 5.1bin>
- In first Command prompt window type: mysqld.exe –skip-grant-tables and pressENTER
- 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
- Now while at the mysql> type here UPDATE mysql.user SET Password=PASSWORD(‘new password’) WHERE User=’root’ and press ENTER
- If everything worked, you should receive QUERY OK …
- Now type FLUSH PRIVILLEGES; and press ENTER, you will receive another Query OK
- 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”
Thanks a lot. It worked for me…
Iv followed all the steps bt “”cant connect to mysql server on local host ” is appeared
what exactly is the error message ? Is your firewall enabled ?
thanks for the detailed guidance. I used Windows Login recovery software, and it is easy to operate for me.I downloaded the Windows Login recovery professional free trial at http://www.windowsloginrecovery.com and get Windows password reset for my pc. Wow, it’s great. users lost password would better have a try.