It happens to all of us at some point or another – especially when doing development work – you find yourself locked out of your WordPress site with no way to change or reset your admin password. What do you do in that situation?
One easy way to fix it is to use phpMyAdmin. This database management tool is available through most hosting plans – your host probably provides it for you.
In phpMyAdmin, open the database for the site you are locked out of. Browse to the “wp_users” table. (If you use a table prefix other than “wp_” make sure you are looking for the users table with that prefix.)
In the users table, locate your admin user account and click edit (see screenshot below).
In the edit screen, look at the line for the field “user_pass”. This is your password. The current password will be a bunch of characters that appear to be gibberish. This is because WP “hashes” your password for security. From the “Function” column, select “MD5” and enter your chosen password in the “Value” column, then click the “Go” button to save your changes.
That’s it! You’ve changed your password and should now be able to log in!
You may be wondering why we selected MD5 for the hash. WordPress originally hashed passwords with MD5, but changed in 2.5 to use PHPass, which is stronger. MD5 is maintained for backward compatibility (and phpMyAdmin does not include the PHPass library). So we select MD5 to set a hash that WP will recognize. Once you log in with your new password, WP will rehash the password to PHPass.