Normally if you forget your password, you can easily use the WordPress password recovery feature to reset the password by e-mail. However, if this option is unavailable because for some reason if your site is hacked, or something else, you are no longer able to login to your admin panel.
In this article, I’ll walk you through how to manually reset the WordPress administrator password through the database with phpMyAdmin.
Things To Do Before Making Any Changes To a Database
Before you make any changes to a database, it is highly recommended to always make a WordPress database backup.
And for some instance, if you running multiple WordPress installations hosted on a single account, chances are a couple of databases are also in place. Thus, you must check your WordPress database name.
The best place to look for is your
wp-config.php which is located in your root WordPress Directory.
Resetting the WordPress Administrator Password from phpMyAdmin
Now that you have figured out the database name, it’s time to actually reset the WordPress admin password in the database.
The first thing you need to do is log in to cPanel.
Then, head over to the Databases section (mine is “database tools”, as I am hosted in Bluehost, it’ll look different than yours) and click phpMyAdmin.
Once you are in phpMyAdmin, in the left-hand pane look for the WordPress database you found in your
wp-config.php and click on it.
A list of tables in that particular database appears.
Look for the table named
wp_users click on it and then click on the Browse tab. This will list all current users added on your website.
Choose the admin user from the list and then, click on the Pencil (Edit) icon to reset the Password.
You will need to edit the Value of the field,
To do so, you would need to use one of the many MD5 Hash generators online to generate your password. One of our favorites is the “md5 Hash Generator” by Miracle Salad.
Simply type your password in it and click the MD5 button to generate hash password as in the image below.
Copy and paste the code into your phpMyAdmin field and click Go to save changes.
On the other hand, you can also do change the password by executing an SQL query in your database.
Simply click on the SQL tab.
Then, copy and paste the following statement into the SQL query text box.
UPDATE `wp_users` SET `user_pass` = MD5( 'new_password' ) WHERE `wp_users`.`user_login` = "admin_username";
Replace new_password with the new password, and replace admin_username with the administrator’s username.
Click on Go to save changes.
You have now successfully changed your WordPress Password from phpMyAdmin with both methods. Whichever method you choose, it will give you the same result.
Note: It is highly recommended to always use a strong password. A Strong Random Password Generator can help.
That’s all! I hope this article helped you learn how to change your WordPress administrator password from phpMyadmin. You can also check this guide on different ways to secure WordPress website from hackers.