How to reset your forgotten WordPress password via the database.
It happens to us all at some point. The fact that we all have to remember so many usernames and passwords we forget our login details to get in to the WordPress admin.
Providing that you can remember your username or email address you can just click on the forgot password link at yourdomain/wp-admin and WordPress will send you a password.
If for any reason you don’t have access to that email address, then it cannot send the details to you. But don’t worry there is an answer.
- Go to your file manager in cpanel and navigate to your public_html folder for the domain, if its a addon domain you need to navigate down to the folder for the domain.
- Locate the wp-config.php
- Right click and edit–> edit
- Towards the top of the file you will see database name, take a note of it.
Now go back to cPanel
- Backup your current database in cPanel in the backups section and download.
- Select phpMyAdmin
- Once in phpMyAdmin select the database name you have taken a not of (if you have more than one)
- Click on wp_users unless you have another prefix xx_users
- Select User ID 1 and click edit.
On the row where it states user_pass do the following:-
- In the function drop down box next to user_pass select MD5
- In the value box on the same line remove the current encrypted password and type in a new one.
- Here you can also take a note of the user login as well if forgotten
- Click Go at the bottom right of the table to save.
Thats it your password has changed, you can login to the yoursite/wp-admin with the new password. Do not change the username or anything else here or it will break your database, for any other changes like email address and display name login and change there.
Databases are very fragile things and changing the wrong thing or not following the instructions to the letter will result in a broken site, hence the recommendation to backup before you start.
If you have any questions please don’t hesitate to get in touch