How to Reset your WordPress Password

 on

It’s frustrating to lose your password, whether you forgot to update it in your password manager or just completely forgot it. Below we’ll cover how to reset your WordPress admin password using multiple methods.

How to Reset your WordPress Admin Password

“Forgot Password” from the WordPress Login Page

  1. If you can’t login as a WordPress user, but you have access to the assigned email address, select “Lost password” on the login page (e.g. example.com/wp-admin). 
  2. Type your WordPress username or email address. Then, select “Get New Password.”

You’ll receive an email including the WordPress username, password reset link, and IPv4 address for the origin of the request. Open the hyperlink to reset your password.

wordpress-login-page.png

Log into WordPress with Softaculous

If your web hosting plan includes Softaculous Instant Installer, and you added your website to it, you can reset the password there. You may even be able to log into WordPress without a password, depending on your web hosting plan.

  1. Log into Softaculous Instant Installer. 
  2. Select the “All installations” button in the upper right corner.
  3. Select the “Admin” column button to login. Then, you can change your password from the dashboard.
    softaculous-wordpress-login.png

    Or, select the “edit” (pencil) button. Under the “Admin Account” section, type the WordPress admin username and a new admin password. At the bottom select “Save Installation Details.” Use the new password on your WordPress login page.
    softaculous-wordpress-admin-password.png

Edit the MySQL Database with phpMyAdmin 

cPanel users can use phpMyAdmin to change the WordPress user passwords. You should backup your database before continuing.

  1. Log into cPanel (e.g. example.com/cpanel or example.com:2083).
  2. Open phpMyAdmin.
  3. Select your WordPress database on the left. The format will usually be “serveruser-wpXXX.”
  4. The selection will expand to list database tables. If you have multiple WordPress databases, select the table with the suffix “_options” to ensure you’re in the correct database.
  5. Select the “_users” table.
  6. Select “Edit” to the left of the admin user.
    phpmyadmin-wordpress-users.png
  7. To the right of “user_pass,” type a new password in the text box. Then select the “Function” drop-down menu and select “MD5” to store the password as a hash. phpmyadmin-wordpress-user-pass.png
  8. Select “Go” at the bottom and you’re done.

WP-CLI in SSH 

Advanced users with Secure Shell (SSH) access can use WP-CLI to update WordPress passwords. Some hosting providers include WP-CLI with certain hosting plans by default.

  1. Log into SSH.
  2. Navigate (cd) to your WordPress root directory.
  3. Ensure you’re in the correct WordPress directory:
    wp option get home && wp option get siteurl
    You should see your WordPress site URL listed twice.
  4. List all WordPress users for the correct user-name:
    wp user list
    wp-cli-wp-user-list.png
  5. Update the WordPress user password, replacing “USER” with the “user_login” and “NewPassword” with a strong password:
    wp user update USER –user_pass=NewPassword
    You should see “Success: Updated user 1.”

PHP Scripts

Emergency Password Reset Script

If none of the solutions above work, you can try the Emergency Password Reset Script. 

  1. Log into your server with SSH, FTP, cPanel File Manager, or another server management software.
  2. Navigate to your WordPress root directory.
  3. Add the Emergency Password Script to a new emergency.php file.
  4. Visit the script URL in your web browser.
    wordpress-emergency-password-reset.png
  5. Type the WordPress user administrator and a new password.
  6. Select “Update Options.”
  7. The page will update to state “Your password has been successfully changed.” You’ll also receive an email notification. After logging in successfully, remove the emergency.php file.

Edit the Functions.php File

If you only have FTP access, you may be able to use FileZilla or another FTP app to regain access. Note that this doesn’t always work.

  1. Log into your web server using FTP.
  2. Navigate to your WordPress root directory.
  3. Download the functions.php file for your active theme. For example, if you’re using the Twenty Twenty-One theme:
    /wp-content/themes/twentytwentyone/functions.php
  4. Edit the functions.php file in Notepad or another plain text editor.
  5. Add the reset script on line 2, under the “<?php” line:
    wp_set_password( ‘password’ , 1 );
    Replace “1” and “password” with your WordPress admin username ID and a strong password.
  6. Save the file.
  7. Upload the modified file back to the server in the same location and login.
  8. After logging in, remove the PHP script from the functions.php file.