WordPress: Reset forgotten password

When installing and running multiple WordPress blogs it is easy to forget the password for one of the accounts used. You are using different login names and passwords for each account now are you? This has happened to me more then once when I’m trying something new and then another project steals my focus or something else comes in between, when I return to the original test I haven’t save the password anywhere or the forget password link isn’t working because I didn’t setup a mailserver or used a disposable email address for that account.

When that happens it’s good to have access to the server because we can always change the password via MySql.

Start by login into your vps and then into mySql.

 

There are a many ways to find and change your password and I’ll show some of them. If you have more ways to update the password, please share with us in the comment section.
All user information is stored in the table wp_users.

First we need to know the ID of the user you are going to change the password for. If you know the username, in this example I will use mikho as username, then we can do this command:

The result would be something like this:

 

But what if you don’t know the username or the above command returns no hits?  One option is to look for all users that has mikho somewhere inside the username, for this we will need to change the SQL query a little bit and use LIKE in the where clause:

This will return all rows with the word mikho in it.

Or you can list all users then by excluding the WHERE clause:

Now we are ready to set the new password. If we look back at the information provided above the ID for the user mikho is 5.

That gives us the following query to run, notice the 5 at the end of the query that defines what user to update and the password will be set to topsecretpassword. Change both ID and topsecretpassword to match your settings.

 

All done! You should now be able to log on to your WordPress blog with your new password.

1 comment for “WordPress: Reset forgotten password

  1. January 27, 2015 at 15:18

    That is great I successfully changed my password.

Leave a Reply

Your email address will not be published. Required fields are marked *