Losing your password is something that happens to the best of us. It can be very frustrating when you have to get into your own website or even after hackers have attacked your website.
In this post, we will be going the DIY route. We are going to be looking into how to reset your WordPress password directly in the MySQL database when your email access is not working or you don’t have a Managed WordPress hosting provider to reach out to.
Before we start, we will take some time to go over how you would normally reset your password with the password reset tool for WordPress.
To start, browse to your WordPress login page, typically this is located at /wp-admin or you can just go to /admin if you have your .htaccess set up correctly, Once you are at the page such as https://domain.com/wp-admin, click on the “Lost your password?” link at the bottom.
On the next screen, enter your username or email address of your WordPress administrator account. Click on “Get New Password” and you will receive a link to create a new password via email.
The second approach which we will be talking about now is resetting your password in the database. To reset WordPress admin password is directly in the database for this step we will be using phpMyAdmin or any other MySQL database tool out there. If you don’t have access to your email or your WordPress site isn’t sending emails correctly, this might be the only solution you have.
This method is also what you would typically do if you are on a local development. If you are a Managed WordPress service customer you can always reach out to for assistance if you don’t feel comfortable doing this.
It is extremely important that you back up your database in case you have to rollback the chance, editing and manipulating tables directly from phpMyAdmin could break your site if not done correctly.
The way to reset your password via phpMyAdmin is using a SQL statement. Simply run the following from the SQL tab. Make sure to update the new_password and admin_username values with your own.
UPDATE `wp_users` SET `user_pass` = MD5( 'new_password' ) WHERE `wp_users`.`user_login` = "admin_username"
To briefly explain the SQL command that you just run, we are basically creating a new password in the database for the user. We use the MD5 function because WordPress doesn’t store passwords in plain text which make it pretty secure.
Once you have successfully reset your password, you can return to your WordPress login screen and use your updated admin credentials to access your site.