How to Quickly Recover Lost WordPress Passwords

If you have a WordPress website, forgetting passwords is extremely frustrating. You get stuck and can’t log in to the dashboard, which also occurs sometimes with the most tech-savvy people.

In fact, WordPress has made it effortless to recover your lost WordPress password securely. Resetting your password by automatic WordPress email is the easiest way. However, if your email isn’t working correctly, things will get more complicated.

Besides email password recovery, there are several options to quickly reset the WordPress admin password. Everything depends on your skills and current access you have. What you need to do is choose the most suitable one that resolves your specific problem.

This post will cover 6 easy ways to recover your lost password for all different types of scenarios you might confront.

Get New Password from Email Password Recovery

As mentioned above, most people who lost WordPress passwords come to this method first due to its convenience and simplicity. WordPress will email you your new password but the precondition is that you have to confirm your email account or user name before asking for resetting the password.

Below are the 5 steps to get a password reset:

  1. Head to your WordPress Login page (sometimes like http://yoursite.com/wordpress/wp-login.php)
  2. Click the Lost your password?

    recoverlostPW_email
  3. After redirected to a new page, enter your username or registered email address
  4. Click Get New Password, check your email inbox and get the new password from WP
    recoverlostPW_email1
  5. Log in to your profile page by the new password and change it to the one you can remember

Reset WordPress Password via PHPMyAdmin

In case you don’t remember your email address or your email isn’t working well, your WordPress site fails to send a reset email. So, recovering your WordPress password directly in the database using PHPMyAdmin is a more ideal option.

Take a look at these steps:

  1. Login to the cPanel dashboard of your WordPress hosting account
  2. In the list of databases, click on the WordPress database of your website
    recoverlostPW_PhpMyadmin1
  3. When the tables containing your database appear, navigate wp_users in the Table column
  4. Click on the browse icon on the right
    recoverlostPW_PhpMyadmin2
  5. Under the user_login, click on the Edit button next to the username that you want to reset the password
    recoverlostPW_PhpMyadmin3
  6. In the user_pass column, select the queue of letters and numbers, delete this and type your desired password in the Value field
  7. Select MD5 from the Function drop-down indicated
    recoverlostPW_PhpMyadmin4
  8. Check your new password and make sure MD5 has been chosen
  9. Click the Go button at the bottom of the page

Keep in mind that this method raises the risk of losing your data and WordPress is not responsible for that loss. You’d better know how to use phpMyAdmin or have a backup.

Reset WP password via FTP Functions File

What if you don’t have access to the WordPress MySQL database or the password reset functionality doesn’t work? Take a deep breath and follow these steps to recover your WordPress password via FPT:

  1. Log in to your site via FTP and download a copy of a PHP file named functions.php from the WordPress hosting server
  2. Edit the file and add the below code to it, right after the first <?php
    wp_set_password( 'password', 1 );

    In this code, password is your new password and 1 refers to the WordPress users ID number in the wp_users table

  3. Save the edits and upload this file back to your website
  4. Once logging in, go back the file and remove that code

Reset Password in WordPress via WP CLI

If two mentioned options are quite challenging, here is an easier way you can try to reset your password directly from the command line. Make sure that you already have a “SSH” or “shell” account and install WP-CLI.

  1. Use this command to see all users
    $ wp user list
  2. Remember the ID number for the user you’d like to update the password
  3. Update the password for that user with this code
    $ wp user update 1 --user_pass=$UP3RstrongP4$w0rd
  4. Remember to replace 1 with the ID of the user, and $UP3RstrongP4$w0rd is your new password

Reset WordPress Password MySQL Command Line

This is the most technical option to reset your WordPress account password. This recovery is managed by a system administrator with full privileges to MySQL database daemon

Follow these simple steps:

  1. Create a MD5 Hash version of the new password with the below command
    # echo -n "newpass" | md5sum
  2. Replace newpass with your own password and save it to later paste to MySQL user password field
  3. Log in to MySQL database and issue the below command
    # mysql -u root -p
    
    MariaDB [(none)]> show databases;
    
    MariaDB [(none)]> use wordpress;
  4. Execute the below command to identify the table storing the WordPress user account. It is usually wp_users
    MariaDB [(none)]> show tables;
  5. Ask wp_users table to retrieve all users ID, login name and password
    MariaDB [(none)]> SELECT ID, user_login, user_pass FROM wp_users;
  6. Identify the username ID that needs the updated password
  7. Update the password by entering
    MariaDB [(none)]> UPDATE wp_users SET user_pass= "e6053" WHERE ID = 1;

    In this case, the user ID is 1, and the new password hash is e6053

  8. Query wp_users table containing the ID of the user that you’ve changed the password to retrieve this user database information.
MariaDB [(none)]> SELECT ID, user_login, user_pass FROM wp_users WHERE ID = 1;

That’s all. Now the new password has been updated and you can easily use it to log in to WordPress site.

Apply Emergency Password Reset PHP Script

Find the listed solutions useless? You can try a final password recovery option: Emergency Password Reset Script. Before trying this, be aware of these things:

  • Emergency Password Reset Script is a PHP script, not a plugin
  • You must enter the administrator’s username and email address before moving to the next steps
  • This PHP script will email you an updated administrator password. The password will still be changed even if you don’t confirm the email
  • You must place the script in the root of your WordPress installation instead of uploading it to your WordPress Plugins directory
  • The script should be removed when you finish

Are you ready? Here are straightforward steps to add the Emergency Password Reset PHP Script:

  1. Copy the emergency script from Emergency Password Script
  2. Locate “emergency.php” in the root of your WordPress installation or create a new file (in case you can’t find that file)
  3. Paste the entire script into that file and save
  4. In your new browser, open http://example.com/emergency.php
  5. Enter the admin’s username and the new password as required. Click Update Options

    The script will send a confirmation email to the blog administrator with the new password. Remember to delete the emergency.php file from your server to prevent someone else using it to change your password again.

Wrapping up!

Although there have been opportunities for you to recover your lost WordPress password, you should reduce its frequent happening. You can check the Always Remember Me checkbox when logging in from secure devices.

If the bad thing comes, you can follow our list of 6 ideas for WordPress password recovery. You can reset the password via email or add Emergency Password Reset PHP Script. Other options with no access to email are through PhpMyAdmin, FTP Functions File, WP CLI or  MySQL command line.

Whether you forget or lost your password, be mindful that you need to change the WordPress password to a more secure password which consists of at least 8 characters and should not be a dictionary word.

If you have any questions about how to recover your lost WordPress password, let us know in the comment section below!

Leave a Reply

Your email address will not be published. Required fields are marked *