I’ve had several people come to me with complete fear in there eyes after losing or forgetting the primary admin password for there website, of course, the first thing to do is issue a password reset! – however if this fails then use the simple guide below to gain access to your website again,
I am going to list 2 methods of achieving this, the first will use PHPMyAdmin a free open-source graphical SQL browser that can be very easily installed but normally comes with most hosting companies control panels such as cPanel,
If you’re unsure what database you’ll be working with then you just need to crack open the config.php file for WordPress, and look for the following lines:
/** The name of the database for WordPress
*/
define('DB_NAME', 'database_name_here');
/** MySQL database username
*/
define('DB_USER', 'username_here');
/** MySQL database password
*/
define('DB_PASSWORD', 'password_here');
The value for DB_NAME
is the name of your WordPress database, and DB_USER
and DB_PASSWORD
are the username and password for the MySQL user that has access to that database.
Once you have this information, you can log in to PHPMyAdmin and select the correct database from the list on the left. From there, you will be able to see all of the tables in the database. One of these tables is called wp_users
, and it contains all of the user accounts for your WordPress site.
To reset the password for the primary admin account, you will need to find the row in this table that corresponds to the admin user. You can do this by looking for the user_login
value of “admin”, or by looking for the ID
value of 1 (since the primary admin account is usually the first account created in WordPress).
Once you have found the correct row, click on the “Edit” link next to it. This will bring up a form with all of the user’s information, including the password. To reset the password, simply delete the current password value in the user_pass
field, and enter the new password in its place. Make sure to choose a strong, unique password, and don’t forget it this time!
Once you have entered the new password, click the “Go” button at the bottom of the form to save the changes. You should now be able to log in to your WordPress site using the new password.
This is just one way to reset a lost WordPress admin password using PHPMyAdmin. The other method involves using the wp-cli
command line tool to directly update the password in the database. This can be a little more technical, but it can also be a good option if you don’t have access to PHPMyAdmin or if you prefer working from the command line.
I hope this helps anyone who has lost their WordPress admin password and needs to reset it. Remember to always choose a strong, unique password and to keep it safe. And if you do happen to lose it, don’t panic – there are always ways to reset it and get back into your site.