Locked Out of WordPress? How to Reset Your Admin Password Without Email Access

What happens when you forgot your WordPress administrator user password and you don’t have e-mails working – meaning you can’t recover the password – nor any other user with administrator capabilities?

Not all is lost. There are a couple of ways to recover your password.

1. Resetting Your Password with phpMyAdmin

This method involves working directly with your WordPress database, so proceed with caution and always back up your database before making any changes.

Here’s how to reset your password via phpMyAdmin:

  1. Access phpMyAdmin through your hosting control panel.
  2. Locate and select the wp_users table. (The prefix may vary, e.g., xyz_users.)
  3. Find the username for which you want to reset the password and click Edit.
  4. In the user_pass column, delete the current encrypted password.
  5. Enter your new password and set the function dropdown to MD5 (this encrypts your new password for WordPress compatibility).
  6. Save the changes.

You should now be able to login with your new password.

2. Using a SQL Query

If you want to cut some corners, you can also run the following SQL query which will pretty much do the same thing as the previous step:

  UPDATE `wp_users` SET `user_pass` = MD5( 'new_password' ) WHERE `wp_users`.`user_login` = 'admin_username';

Replace:

  • new_password with your desired password.
  • admin_username with the actual username of the account.

Note: This method is NOT recommended at all if you don’t have experience with SQL.

3. Resetting password via FTP

If you don’t want to mess around with SQL you can also connect to your server via FTP and modify your currently active theme functions.php file.

  1. Connect to your server using a FTP client (e.g., FileZilla).
  2. Navigate to the folder of your active theme, usually under wp-content/themes/active-theme/.
  3. Open the functions.php file and add the following line of code:
wp_set_password('new_password', 1)
  • Replace new_password with your desired password.
  • Replace 1 with the user ID of the account you want to reset. (User ID 1 is typically the default admin account.)
  1. Save the file and reload your website. The code will execute and reset your password.
  2. Remove the added code to avoid overwriting the password every time the website loads.

4. Resetting Passwords with WP-CLI

This method is a bit more advanced, but if you have access and know about WP-CLI, this is a fast and efficient way to reset your password.

  1. Run the following command to list all users:
wp user list
  1. Find the user ID of the account you want to reset the password.
  2. Execute the following command to reset the password:
wp user update {ID} --user_password=new_password

Replace:

  • {ID} with the user ID of the account.
  • new_password with the desired password.

Leave a Comment

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