You attempt to use the “Lost Your Password?” link on the main login page of your WordPress site. The password reset email never arrives.
You’ve completed multiple attempts, allowed the server plenty of time to send the email, and you’ve checked (and re-checked) your spam folder. Still, no luck.
When I recently forgot the password to my tech troubleshooting blog, I found most of the resources available on this topic to be totally useless.
Many of the proposed solutions involve installing a plugin. The last I checked, in order to install a plugin you need to be logged in to your site. And if you could login, you wouldn’t have an issue in the first place!
Fortunately there are two approaches you can use to reset your password, that DO NOT require prior account access.
If WordPress is not sending the password reset email, log into your web host account and open the cPanel (or cPanel alternative). Then select phpMyAdmin to access the MySQL database and reset your password. As a last resort, access your File Manager and run the emergency password reset PHP script.
Reset Password From MySQL Database
MySQL is what’s known as a relational database management system (RDBMS) based on structured query language (hence the “SQL”). It’s the database all WordPress websites use to store and retrieve their respective data.
In fact, all of the information and underlying code that makes your site tick is automatically logged here.
Because this process is automatic and happening behind the scenes, the vast majority of WordPress users are blissfully unaware of MySQL’s existence.
And that’s just what its’ developers intended!
WordPress was designed as an open-source content management system that doesn’t require any prior programing knowledge to use.
Ok, cool. But why am I telling you this?
Remember how I said MySQL stores all of your site’s data? Well that includes your WordPress password! Therefore, if you can access your site’s MySQL database, you can manually change your password.
How To Access MySQL Database
The easiest way to access your MySQL database is via phpMyAdmin within your web hosting cPanel. All you really need to know here is that phpMyAdmin is an administration tool that allows you to access your MySQL database directly.
This process can vary slightly depending on the host you use.
For example, if you use Bluehost, once you’ve logged in you’ll select Hosting > cPanel from the menu bar at the top. Then, within the cPanel select Advanced from the left sidebar menu and click phpMyAdmin under Databases.
Other popular cPanel web hosts including HostGator, A2 Hosting, InMotion, and GoDaddy all follow a similar process.
It’s important to note that some popular hosts like Cloudways (our hosting provider for Niche Twins) have their own homegrown cPanel alternatives.
For Cloudways users, once you have logged in, set the toggle to Applications at the top of the screen and select your website application. Then within Access Details under the heading MYSQL ACCESS, click LAUNCH DATABASE MANAGER.
How To Change WordPress Password In MySQL Database
Ok, so you’ve now successfully logged in to your MySQL database.
Users logging in via their cPanel and phpMyAdmin will need to follow the steps in the exact order detailed below:
- Within phpMyAdmin, select databases followed by your specific WordPress database.
- Locate wp_users in the table that populates and click the browse icon.
- Under user_login, find your WordPress username and click edit (pencil icon).
- Once your user_id is shown, click edit.
- Now next to user_pass, delete the long password that is listed and type in a new password (remember your password is case sensitive).
- Once your new password is populated, click the drop down menu under the Function column and select MD5.
- After you have double checked your password, click the Go button in the bottom right corner of the screen.
Cloudways users on the other hand will follow a slightly modified process:
- Once you launch the Database Manager, click wp_users from the table.
- Next, click the Select data tab at the top of the page, click the empty box next to your corresponding user_login ID and click the Edit button.
- Finally, under user_pass select MD5 from the drop down menu, change your password, and click Save.
That’s it! Go ahead and head back over to your WordPress login page and use your new password to gain access.
Emergency Password Reset PHP Script
What if for some reason you are unable to reset your password via the MySQL database?
Users with web host login access can deploy an emergency password reset PHP script.
For this method, you will need to log back into your cPanel and locate File Manager (or ‘My File Manager’ depending on your specific host provider).
Within the File Manager create a new file and name it “emergency.php”. Then copy the emergency password reset php script and paste it into the emergency.php code field. Save and close the file.
Now type the URL of your website into your search browser with “emergency.php” included at the end. For example, for Niche Twins we would search “https://nichetwins.com/emergency.php”.
You will now arrive at the landing page depicted below.
Under username, you must enter the WordPress administrator’s username for the site. Then enter any password you wish (be sure to copy the password down), and click Update Options.
An email will be triggered to the admin’s listed email account. Notably, the password will be changed regardless of whether you can access this email or not.
As soon as you are able to log in to your WordPress account, be sure to go back to the File Manager and delete the emergency.php file immediately. If you do not, anyone can use this same script to change your password again, posing a significant security risk.
Forgetting your WordPress password and then not receiving the password reset email is an anxiety trip. I know. I’ve been there.
The two primary ways to reset your password that DO NOT require email access include:
- Resetting the password via the MySQL database
- Running the emergency password reset PHP script
Notably, for both methods you will need to log into your web host account and access the cPanel (or cPanel alternative).