Recover Password On MySQL Under Windows

How To Recover Your MySQL Password

mysql password

Resetting MySQL password under Windows - How To



If you are like me who had forgot your mysql password on the root (or any user) account, then you cannot also use your mysql server. I have tried uninstalling and reinstalling the program but mysql told me that uninstalling the mysql doesn't really delete the user database information. So if you are planning to do it, don't bother.

Good news to all of us, though we can recover the password on our 'mysql' table on the mysql server, it will be useless to us since it is hash encrypted remember? So resetting the password is what we want for this, and here's how we do it under Windows.



Step 1.) FIRST WE NEED TO STOP MySQL SERVER COMPLETELY

* right click 'My Computer', select 'Manage', expand 'Services and Applications', select 'Services', locate and select 'MySQL' service and click on 'stop' link.
* another and easier way is to get into the task manager's 'Process' tab, locate and select MySQL and just click on 'End Process' button.


Step 2.) OPEN A COMMAND PROMPT WINDOW
* (excuse me for the pros) start - all programs - accessories - command prompt
* go to your mysql's bin directory, mine is under C:\Program Files\MySQL\MySQL Server X.X\bin
* type this on your command prompt window exactly mysqld.exe -u root --skip-grant-tables and press enter.

if you see an error message like the image below, don't panic, just leave (do not close) the command prompt window and proceed to the next step.

mysql reset recover password

Step 3.) OPEN ANOTHER COMMAND PROMPT WINDOW
* again, navigate to your mysql's bin directory.
* enter mysql and press enter

you should now inside the mysql environment

* activate mysql table by using the use mysql commannd
* type this command to reset your root password
update mysql
set password='your desired password here'
where user='root';
and press enter.

That should do it, your password has been reset.

This procedure has been fully tested on the current MySQL version today which is MySQL Server 5.1. If you have different version, doing this could be slightly different but should be the same.

Log to your MySQL server using your new password, enjoy!

0 Comments :

Post a Comment