Test your skills on our all Hosting services and get 15% off!

Use code at checkout:

Skills
21.10.2024

How to Manually Reset Your WordPress Admin Password

If you’ve forgotten your WordPress admin password and can’t reset it via the standard “Forgot Password” link, you can manually reset your password using several methods. Here’s a step-by-step guide on how to manually reset your WordPress admin password through phpMyAdmin, FTP, and functions.php.

Method 1: Reset Your Password via phpMyAdmin

This method involves accessing your WordPress database directly through phpMyAdmin. This is typically available via your web hosting control panel.

Step 1: Log in to Your Hosting Control Panel

  1. Log in to your cPanel or web hosting control panel.
  2. Find and click on phpMyAdmin under the Databases section.

Step 2: Access the WordPress Database

  1. In phpMyAdmin, locate the database used by your WordPress site (this is usually named similar to your site or prefixed with wp_).
  2. Click on the database name to expand its tables.

Step 3: Find the Users Table

  1. Look for the table that ends with _users (it will often be called wp_users, but this can vary depending on your table prefix).
  2. Click on the wp_users table to open it. This table contains information about all registered users.

Step 4: Edit Your Admin User Password

  1. Find the row that corresponds to your admin username (usually ID 1).
  2. Click the Edit button (a pencil icon) next to the admin user’s row.
  3. In the user_pass field, you will see your current password in an encrypted format (hashed using MD5).
  4. Select MD5 from the Function dropdown next to the user_pass field.
  5. Enter your new password in plain text in the Value column.
  6. Scroll down and click Go to save the changes.

Step 5: Log in to WordPress

After saving your changes, you can now log in to your WordPress admin dashboard using the new password you set.


Method 2: Reset Your Password via FTP by Modifying the functions.php File

If you don’t have access to phpMyAdmin, you can reset your password by adding code to your theme’s functions.php file via FTP.

Step 1: Access Your Website via FTP

  1. Use an FTP client (like FileZilla) to connect to your website’s server. You’ll need your FTP credentials (available in your hosting control panel).
  2. Once connected, navigate to the /wp-content/themes/ folder.
  3. Open the folder for your active theme.

Step 2: Edit the functions.php File

  1. Inside the active theme folder, locate the functions.php file.
  2. Right-click the file and choose View/Edit to open it in your text editor.

Step 3: Add Code to Reset the Password

  1. Add the following code to the bottom of the functions.php file:
    wp_set_password(‘new_password’, 1);

    Replace ‘new_password’ with the new password you want to use. The number 1 refers to the user ID of the admin user (usually ID 1).

  2. Save the file and upload it back to the server via FTP.

Step 4: Log in to WordPress

  1. Log in to your WordPress admin dashboard using the new password you just set.
  2. Once logged in, remove the code from the functions.php file to avoid security risks:
    • Open functions.php again via FTP and delete the code you added.
    • Save and re-upload the file.

Method 3: Reset the Password via wp-cli (Command Line)

If you have SSH access to your hosting server, you can use wp-cli to reset the password. This is a quick and efficient method for users comfortable with the command line.

Step 1: Log in via SSH

  1. Connect to your server via SSH using a terminal application (e.g., PuTTY or the Terminal app on macOS/Linux).
  2. Navigate to your WordPress root directory.

Step 2: Run the wp-cli Command

  1. Run the following command to update the admin user’s password:
    wp user update 1 –user_pass=”new_password”

    Replace new_password with your new password. The number 1 is the user ID of the admin.

Step 3: Log in to WordPress

Once the command is executed, you can log in to your WordPress dashboard using the new password.


Method 4: Reset Password via the Emergency Password Reset Script

WordPress offers an emergency password reset script that you can manually upload and use to reset the admin password.

Step 1: Download the Emergency Script

  1. Download the emergency password reset script from WordPress’ official resources at WordPress Codex.

Step 2: Upload the Script via FTP

  1. Use an FTP client to upload the script to your WordPress root directory (where wp-config.php is located).

Step 3: Run the Script

  1. After uploading, go to the script’s URL in your browser (e.g., yoursite.com/emergency.php).
  2. Follow the on-screen instructions to reset your admin password.
  3. Once complete, delete the script from your server for security reasons.

Conclusion

Manually resetting your WordPress admin password is easy with access to phpMyAdmin, FTP, or wp-cli. By following these methods, you can regain access to your WordPress dashboard quickly and safely. Be sure to remove any code or scripts added during the process to keep your site secure after resetting the password.

Test your skills on our all Hosting services and get 15% off!

Use code at checkout:

Skills