How to reset a WordPress password on the database

You’ve gone and forgotten your password? You didn’t set up your recovery email address? No, it wasn’t your fault, the client has forgotten? You inherited the site and the records aren’t right? Well whatever the reason, don’t panic. This guide will show you how to recover that account without having to do anything too drastic.

This guide isn’t for total noobs. I’m assuming that you can fend for yourself to a certain extent. If not you need to show this guide to your web developer and ask them to help you out. It also assumes that you have access to a copy of phpMyAdmin which is installed on virtually every hosting platform out there.

So first you need to locate your phpMyAdmin install. If you have Plesk on your server, log in to that, drill down to the problem site and then into the database settings for that account. If you have cPanel then you will be able to get to phpMyAdmin through that too. If not then you probably have access to it via your main hosting admin / billing panel. Try searching your hosting companies support section if you can’t find it.

You might have more than one WordPress installed in the account and if you installed it with a script installer then it could have a cryptic name like wp_wordpress5 or something. If you’re not sure about the database name that the site is using then check wp-config.php which is in your root folder. Normally the first line in this will be something like this:

define('DB_NAME', 'somesite_wp');

Thats your database name so make a mental note to look for that when we get into phpMyAdmin.

Ok follow the procedure you discovered earlier to get phpMyAdmin loaded up. Over the years phpMyAdmin has had some facelifts and changed slightly. You might see some slight visual differences in if your host hasn’t kept up to date but push forward and everything should work ok.

The initial screen will likely already have your database selected and you will see a list of tables down the left hand side which looks like this:


If not, click the Databases tab along the top. Then in the list of available databases just click on the database name you made a note of earlier.

The account details are all stored in the wp_users table. Click on that either in the left hand side menu or if you have the structure tab open you click also click the name or the browse button in the main page.

This will take you to a page which has the Browse tab selected at the top:


Look down the table and find the account you need to reset the password for:


If you have a lot of users you might need to use the pagination buttons at the bottom of the page:


Or if its a huge site you can search by clicking the “search” tab along the toolbar at the top:

This will take you to a page that searches the current table. You will probably want to search on the user_login line and make sure “LIKE” is selected in the Operator column (this will match partial usernames too):

When you find it you need to click the edit button for that row:


Now we’re in business.

The Password Reset Technique

You will see  a row called user_pass. In it there will be a line of gibberish text. To update your password just type your new password into the Value field:


But wait! There’s more. The text was originally in gibberish because the password is encoded using an MD5 hashing technique. Open up the empty select box in the screenshot above (the Function column) and select MD5. This will apply the MD5 hash function to your text and you too will be the proud owner of a line of gibberish.

Just save it out to complete this process. At the bottom of the page, make sure Save is selected and click Go:


You will now be able to log in to your WordPress site with the username and the new password you just encoded.

No comments :