How to Reset Your WordPress Admin Password:Step-by-Step Guide

How to Reset Your WordPress Admin Password
Reading Time: 4 minutes

Forgetting your WordPress admin password can be frustrating, but the good news is that there are multiple methods to reset it. This guide will walk you through each step in detail, with examples and code snippets where necessary, so you can quickly regain access to your WordPress site.

In this post, we’ll cover five main methods to reset your WordPress admin password:

  1. Using the WordPress built-in password reset option.
  2. Resetting the password via the WordPress database using phpMyAdmin.
  3. Editing your functions.php file to reset the password.
  4. Using WP-CLI to reset the password.
  5. Using the emergency password reset script.

Method 1: Resetting WordPress Admin Password via Built-In Password Reset Option

This is the easiest and most common method for resetting your password, especially if you still have access to the email associated with your WordPress account.

Step-by-Step Instructions:

  1. Go to the Login Page: Visit your WordPress login page by typing /wp-admin or /wp-login.php after your website’s URL (e.g., yourwebsite.com/wp-admin).
  2. Click on “Lost your password?”: Under the login form, click on the “Lost your password?” link.
  3. Enter Your Email: Enter the email address associated with your WordPress admin account and click Get New Password.
  4. Check Your Email: You will receive an email with a password reset link. Open the email and click on the link.
  5. Create a New Password: After clicking the link, you’ll be redirected to a page where you can enter a new password. Once you’ve chosen a strong password, click Save.

That’s it! You should now be able to log in using your new password.


Method 2: Resetting WordPress Admin Password via phpMyAdmin

If you don’t have access to the email associated with your WordPress account, you can reset your admin password directly from your WordPress database using phpMyAdmin.

Step-by-Step Instructions:

  1. Login to Your Web Hosting Control Panel (cPanel): Access your hosting control panel (such as cPanel) and navigate to phpMyAdmin.
  2. Select Your WordPress Database: In phpMyAdmin, find the database for your WordPress site in the left-hand sidebar and click on it.
  3. Find the wp_users Table: Scroll through the list of tables and locate the one called wp_users (the prefix may differ if you changed it during installation).
  4. Edit Your Admin User: In the wp_users table, find the row that corresponds to your admin account (usually the user with ID 1). Click the Edit link next to it.
  5. Change the User Password:
    • Look for the user_pass field.
    • In the “Function” dropdown next to it, select MD5 (WordPress used to hash passwords with MD5, but will rehash it securely when you log in).
    • In the “Value” field, enter your new password.
    UPDATE `wp_users` SET `user_pass` = MD5('new_password_here') WHERE `ID` = 1;
  6. Save Changes: Scroll down and click Go to save your changes.

Now, you should be able to log in to your WordPress admin dashboard using your new password.


Method 3: Resetting WordPress Admin Password via functions.php

If you’re locked out of your WordPress dashboard and don’t have access to the database, you can reset your password using the theme’s functions.php file.

Step-by-Step Instructions:

  1. Access Your Site via FTP or File Manager: Use an FTP client or your hosting file manager to access your WordPress files.
  2. Navigate to Your Theme Folder: Go to wp-content/themes/your-active-theme/.
  3. Edit the functions.php File: Download or edit the functions.php file and add the following code at the bottom: function reset_admin_password() { $user_id = 1; // The admin user ID wp_set_password( 'newpassword', $user_id ); } add_action( 'init', 'reset_admin_password' );
  4. Upload and Save the File: Save your changes and upload the file back to the server.
  5. Log In and Remove the Code: Now, log in to your WordPress dashboard using the new password newpassword. After successfully logging in, go back and remove the code from your functions.php file to avoid security issues.

Method 4: Resetting WordPress Admin Password via WP-CLI

If you have access to your server’s command line interface and WP-CLI is installed, resetting the admin password is quick and efficient.

Step-by-Step Instructions:

  1. Connect to Your Server via SSH: Use an SSH client like PuTTY to connect to your server.
  2. Navigate to Your WordPress Directory: Once logged in, change the directory to your WordPress installation: cd /path/to/your/wordpress
  3. Run the Command to Reset the Password: Use the following WP-CLI command to reset the admin password: wp user update admin --user_pass="new_password_here" Replace admin with your actual admin username, and new_password_here with your desired password.
  4. Log In: After running the command, log in to your WordPress dashboard with the new password.

Method 5: Using the Emergency Password Reset Script

If all else fails, WordPress provides an emergency password reset script you can use to reset your admin password.

Step-by-Step Instructions:

  1. Download the Emergency Password Script: Go to the official WordPress site and download the emergency password reset script.
  2. Upload the Script to Your Root Directory: Use FTP or your hosting file manager to upload the script to the root directory of your WordPress installation (the same directory as wp-config.php).
  3. Run the Script: In your browser, navigate to the script: http://yourwebsite.com/emergency.php
  4. Enter Your Admin Username: Enter the admin username and new password, then click Reset Password.
  5. Delete the Script: After successfully resetting the password, make sure to delete the script from your server to prevent security vulnerabilities.

Tips for Keeping Your WordPress Password Secure

  1. Use Strong Passwords: Always use a strong password that includes uppercase letters, lowercase letters, numbers, and symbols.
  2. Enable Two-Factor Authentication: Add an extra layer of security by enabling two-factor authentication (2FA) on your WordPress site.
  3. Regularly Update Passwords: Change your password regularly to reduce the risk of your account being compromised.
  4. Limit Login Attempts: Install a plugin like Limit Login Attempts Reloaded to prevent brute force attacks.

Resetting your WordPress admin password is relatively straightforward, even if you’re locked out of your email or dashboard. Whether you prefer to use the built-in reset option, access phpMyAdmin, or use advanced tools like WP-CLI, this guide has provided several methods for you to regain access to your WordPress site.

By following these methods, you’ll be able to restore access to your WordPress dashboard in no time, ensuring that you can continue managing your site without disruption.

Share the Post:

Related Posts

Join Our Newsletter!

Scroll to Top

CONTACT US

Days :
Hours :
Minutes :
Seconds
Currently, we are only providing premium service. Contact us for more details!

Need a FREE WordPress Health Check Service!