wordpress

How to Reset WordPress Admin Password

How to Reset WordPress Admin Password

How to Reset WordPress Admin Password

Everyone needs to reset one of their passwords from time to time. WordPress makes it easy to change your password if needed, but to do that, you’ll need to have access to the email you used when you created your site. If you don’t, things can get tricky. Fortunately, there are a few workarounds to that problem.

In this article, we’ll teach you how to:

  1. Reset WordPress Admin Password (with access to your email).
  2. Reset WordPress Password from phpMyAdmin.
  3. Reset WordPress Admin Password via MySQL Command Prompt.

1. Reset WordPress Admin Password (with access to your email)

The first way to reset WordPress admin password is via the standard login page. This assumes you have access to your email.

Step 1

Browse to your WordPress login page, typically this is located at /wp-admin, such as: https://domain.com/wp-admin. Then click on the “Lost your password?” link at the bottom.

Step 2

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.

2. Reset WordPress Password from phpMyAdmin

How to Reset a WordPress Password from phpMyAdmin

3. Reset WordPress Admin Password via MySQL Command Prompt

In this guide we will show you how to reset a WordPress account password via MySQL command line in Linux.

Before logging in to MySQL/MariaDB database service, first create a MD5 Hash version of the new password that will be assigned to the account, by issuing the below command.

Replace the “newpass” string used in this example with your own strong password. Copy the password MD5 hash to a file in order to later paste the hash to MySQL user password field.

# echo -n "newpass" | md5sum

How to Reset WordPress Admin Password

After you’ve generated the new password MD5 hash, log in to MySQL database with root privileges and issue the below command in order to identify and select the WordPress database. In this case the WordPress database is named “wordpress”.
# mysql -u root -p
MariaDB [(none)]> show databases;
MariaDB [(none)]> use wordpress;

Next, execute the below command to identify the table responsible for storing WordPress user accounts. Usually the table that stores all user information is wp_users.

Query wp_users table to retrieve all users ID, login name and password and identify the username ID field of the account that needs the password changed.
The username ID value will be used to further update the passwor

MariaDB [(none)]> show tables;
MariaDB [(none)]> SELECT ID, user_login, user_pass FROM wp_users;

After you’ve correctly identified the ID of the user that needs the password changed, issue the below command to update his password. Replace the user ID and password MD5 Hash accordingly.

In this case the user ID is 1 and the new password hash is: e6053eb8d35e02ae40beeeacef203c1a.

MariaDB [(none)]> UPDATE wp_users SET user_pass= "e6053eb8d35e02ae40beeeacef203c1a" WHERE ID = 1;

How to Reset WordPress Admin Password

In case you don’t have an already MD5 hashed password, you can execute MySQL UPDATE command with the password written in plain text, as shown in the below example.

In this case we’ll use MySQL MD5() function to calculate the MD5 hash of the password string.

MariaDB [(none)]> UPDATE wp_users SET user_pass = MD5('the_new_password') WHERE ID=1;

After the password has been updated, query wp_users table with the ID of the user that you’ve changed the password in order to retrieve this user database information.

MariaDB [(none)]> SELECT ID, user_login, user_pass FROM wp_users WHERE ID = 1;

That’s all! Now, inform the user that his password has been updated and it should be able to log in to WordPress with the new password.

Conclusion

Resetting your password should always be easy. However, the process often requires you to have access to the email you used when signing up. If you don’t, things can get complicated. The good news is that, as we’ve seen, WordPress enables you to change your password through your database. That way, you can reset your WordPress password no matter what happens.

Do you have any questions about how to reset your WordPress password, using any of the methods we’ve introduced? Let’s talk about them in the comments section below!

About the author

Amy Gorrell

Amy Gorrell

Amy is a content writer at ERROR HAT. She has years of experience in business and marketing. She also loves technology-related topics. Apart from writing, love to read and watch movies.

Add Comment

Click here to post a comment