Table of Contents
In this article I will show you one solution on how to recover, in case you forgot WordPress Password.
This method works even if you forgot WordPress password and username. You can use this method also if you forgot WordPress password on localhost, as well as in the shared server.
Note: To be able to use use this method to reset your WordPress password, you must have access to the phpMyAdmin or your MySQL server and database
Login to phpMyAdmin
First you need to log in to your phpMyAdmin to be able to see the WordPress database and tables.
If you are in a shared hosting and using the cPanel, then phpMyAdmin can be accessed by clicking the button as below:
It should work similar if you are using other web hosting control panels, like Plesk or any other.
How to find the database of my WordPress website?
There are many ways to find which database is linked to certain WordPress website.
You can do it from the “wp-config.php” file, going through each database by checking the “siteurl” option field in the options table etc.
Since we are already in the phpMyAdmin, I will show you how to find the “siteurl” in the options table.
In phpMyAdmin click each database to open the table list, then search for the (prefix)_options table (where prefix is whatever prefix your tables are using, so the prefix is the word that comes before the underline “_” symbol of the table name)
After options table is opened, usually “siteurl” is the first “option_name“. In the “option_value” field, you will see the site name.
How to find the WordPress username and password?
Once you are sure that you are in the correct database, then you need to open the users table (similarly as the options table, it will be proceeded from and prefix and underline symbol ex. wp_users).
In this table you will see all the WordPress username and passwords.
There are other columns as well, but you will need only the “user_login” and “user_pass” fields, but of course you can also change other fields if you want (the user_email for example).
What to do next?
Even though you can see the “user_pass” (which looks something like this: $P$BRqPT9szMoNYtJrn9j9Rm3W/Vxy8ab. ), you are not done yet, because the string in the “user_pass” column is the encrypted representation of the password.
To be able to login, you need to know the decrypted string.
But, since, it is impossible to decrypt the password, because WordPress uses, what are known, one way encrypted passwords, which means the passwords are only encrypted and can’t be decrypted.
Using a WordPress Password Hash Generator
In this step you need to look for an online WordPress Password Hash Generator.
There are many websites that offer this service, but you can use this one: https://www.useotools.com/wordpress-password-hash-generator
In the “input password” field insert your new password string (always make sure that your password is a complex string, by having lowercase and uppercase characters, number, special characters etc.)
Once you input your new password, check the “Image Verification checkbox of reCaptcha” and hit Generate Hash.
In the next page, you will get your password string and the hash value (which looks something like this $P$BtaFjPOYGvUeK80kz0N/mFpe0.rfrd/ as an example).
Copy the hash value and go back to your users tables in phpMyAdmin.
Edit the row of the user whose password you want to update and then paste the hash value in the “user_pass” column and save the record.
And that’s it, you now know your WordPress username and have reset your password.
Login to WordPress
Now, go to your WordPress login page, insert your username and your newly created password.
Be careful: In this page you need to use the actual password string, not the hash value. The hash value is only used to update the users table in phpMyAdmin
(in our case we used MySecretPassword123 as actual password and the string: is the hashed value)
Conclusion
Hopefully this will help you to restore your access in case you forgot WordPress password and username.
Thanks for reading the article and see you in the next article.