How To Reset WordPress Password via MySQL Command

I decided to write this article because recently I was totally locked out of my blog because I forgot my username and password and unfortunately for some reason the reset password via email is not functioning.. LOL

My last option was to reset it via SSH and do some MySQL FU. ūüôā

Okay here we go with the few steps to reset our password.

1 .  Login to your server via SSH.

2 . Login to MySQL

3.  Once you are in you will need to select the correct database. Look for the name that you found in your wp-config.php.

Command to show list of database:

4.  Select the correct database and DB table. Let say our database name is freedomSMS.

Selecting database:

Showing available tables in DB freedomSMS:

5. We are looking for the users table to reset our password. If you didn't change the table prefix during installation then the default would be wp_users table.

To show all users in wp_users table:

6.  The above command will show the users in your wordpress blog and other details like login password.  You will notice that there are many random characters stored in the password field of the user. Due to security reasons, WordPress stores the passwords as MD5 Hash rather than Plain text.

This means that you will not be able to enter plain text as the password. If I would like 'iloveyou'  to be my new password then the equivalent MD5 hash for that is 'f25a2fc72690b780b2a14e140ef6a9e0' .. Use this website to generate MD5 hash.

7. Updating user password.  For Example we will update or change the password of user Mboy.

Enjoy! You can now login to your wordpress site using Mboy as username and iloveyou as your password..! ūüôā


About Mboy 26 Articles
I'm a lover and a good friend.. :)

Be the first to comment

Leave a Reply

Your email address will not be published.