WordPress: Change admin password without access to backend directly on database


If you loose the password to your wordpress backend you usually just use the forgotten password link to reset it. But what if you don’t have access to that emailadress any more? What if that emailaddress belongs to somebody else? There is a workarround to change that password directly on the database without access to the wordpress backend.
You will still need access to the database of course.

Inspect the wordpress database

First we need to look into the wordpress database. Most hostingproviders offer phpMyAdmin to inspect your database. If you don’t have that, you can download a SQL-Client which can connect to your database. In this example I will work with phpMyAdmin, but the steps are the same with other tools.

After opening your wordpress-database with phpMyAdmin your should see this:

Changing wordpress password without backend access
Using php to change a wordpress password without accessing the backend.

Select the users table. If you haven’t installed any plugins it is at the bottom of the list. The name is _users with a prefix. In my picture the prefix is “kv”.

Change the password of the wordpress user in the database

In the middle of the screen you should now see a list of all users. Select the user you want to change.

WordPress doesn’t save the password itself in the database but a MD5-Hash of it. You will have to do the same.

I usually just use “password” as password. The MD5-Hash for it is:
Afterwards I use the account to log in the backend and change it to whatever I want.

If you want to use another password you can google MD5-Generator to create the corresonding MD5-Hash.

If you have the hash for your password, just double click on the field user_hash that you want to change and paste it in.

You can now use the new password. If you have any trouble with this method, leave me a message in the comments.

No Database-Access

If you don’t have database-access there but can still access the website via FTP you can make some changes to the functions.php to alter a user-account or create a new one. Here you can read more about this approach.


Please enter your comment!
Please enter your name here