If you’re like us, chances are, every so often you will forget a WordPress Administrator password and you’ll need to reset it. Luckily, WordPress has quite a number of ways in which you can change an Administrator (or any other user) password, of course as long as you still have access to the website via your hosting account.
Reset your password via email
WordPress makes it very easy to reset your password if you have access to the original email that you had associated with your account. Simply visit the WordPress login page, and click on the Lost your Password link.
You will then be asked to enter the username or the email address of the user whose password you have forgotten.
Once you do that, you will be sent an email with a link to reset the password. Click on the link and follow the instructions.
Change your WordPress password via PHPMyAdmin
Be Careful: Do not perform any modifications, delete or change any of the WordPress database tables if you do not know what you are doing. You can potentially corrupt your database, lose information or delete your whole database.
You can change the admin password if you have access to PHPMyAdmin. Browse to PHPMyAdmin using the database administrator and password which you should have available as part of your WordPress web hosting details.
Now you’ll need to access the Users table in PHPMyAdmin:
On the left, you will see 2 links, click on the name of the database of the WordPress site you want to change the password for. You will see all the table names are prefixed with some letters, e.g. wp_
The table names are on the right of the Underscore.
Scroll down to the table wp_users. Click on the ‘Browse‘ tab.
You will now see a list of users – you need to find the user which you want to change the password for. Click on the ‘Pencil‘ or Edit to edit the WordPress Administrator user.
The next screen is where you can change your password, find the user_pass field:
-
- Change the user_pass dropdown to ‘MD5′
- Enter in a new password in the text box beside it – you can enter it in plain text, the password will then be encoded by PHPMyAdmin
See the screenshot below of how your wp_users table should look like. Then press Go.
Once you have done this, your WordPress administrator password is changed. You will see on the next screen that the password field changed to a bunch of letters and numbers that you didn’t enter.
That’s ok, because that’s how MySQL stores your password. Don’t forget this password too 🙂
Go to your WordPress Administrator login and try out the new username and password you entered.
Change your password via FTP or the File Manager of CPanel
You can also change the password by changing a file via FTP or using the CPanel File Manager.
- Access the files of your website via FTP or File Manager and edit the functions.php file of your current theme
- Edit the functions.php file and add the following to it, at the very top right after the first <?php
wp_set_password( 'password', 1 );
- Change the ‘password’ text with your new password for the admin user. The reason why we put “1” is because the user ID number in the wp_users table of the Administrator is usually 1 – although sometimes it may not be the case. In that case, you’d have to use the above method via phpmyadmin
- Save the modified file back to your site – replacing the old version and access the front-end of your website, and make sure you refresh the site at least once
- After refreshing, you should be able to log in
- VERY IMPORTANT: Make sure that you remove this code by following the same procedure. Besides being a vulnerability because the password is stored in plaintext, the code will reset your password each time you access your site until you remove it.
And these ladies and gentlemen are the easiest ways to reset the WordPress administrator password if you forgotten it!