🔐 How to Reset Your WordPress Admin Password (Step-by-Step Guide)

Losing access to your WordPress admin account is frustrating—but it’s also very fixable. Whether your email reset isn’t working or you’re locked out entirely, there are several reliable ways to regain access.

This guide walks through the most practical methods, starting with the easiest and moving to more advanced options.

🔁 Method 1: Use the Built-In Password Reset

https://images.openai.com/static-rsc-4/rDpgf4UW0wfxHba_bc9jvX9nqB9Il1ofamEgLwCRcM4q4VMtFc8vnxo42aBOCHHPBouf8t95wmkxqduL1wmr2x-0rVSSAYizuISOtqrGcR_uAcBo5Oqsqa1u8c375luvVwQjtXTL9nBdz-zlfSUztBsvtc5oV_md2scsa6XIMhx5e-qwinA5mlzycmt-0-R1?purpose=fullsize

If your email system is working correctly, this is the fastest method.

Steps:

  1. Go to your login page: https://yourdomain.com/wp-login.php
  2. Click “Lost your password?”
  3. Enter your username or email
  4. Check your email and follow the reset link

⚠️ Common Issue:

Many self-hosted WordPress sites do not have email configured properly. If you don’t receive the email, move on to the next method.

🛠️ Method 2: Reset Password via Database (Most Reliable)

This method works even when everything else fails.

Step 1: Access your database

Use:

  • phpMyAdmin (via hosting panel)
  • MySQL CLI
  • Admin tools like Adminer

Step 2: Locate the users table

Look for:

wp_users

⚠️ Your table prefix may not be wp_. Check your wp-config.php file for:

$table_prefix = 'yourprefix_';

Step 3: Run the reset query

UPDATE wp_users 
SET user_pass = MD5('NewStrongPassword123!')
WHERE user_login = 'admin';

Step 4: Log in

Use your username and the new password.

WordPress will automatically rehash the password securely after login.

🖥️ Method 3: Reset Using WP-CLI (Best for SSH Access)

If you have SSH access, this is the cleanest method.

List users:

wp user list

Reset password:

wp user update admin --user_pass="NewStrongPassword123!"

Use this only if other methods are not available.

Create a file (e.g., reset-password.php):

<?php
require_once('wp-load.php');
wp_set_password('NewStrongPassword123!', 1);
echo "Password reset.";

Steps:

  1. Upload the file to your WordPress root directory
  2. Visit: https://yourdomain.com/reset-password.php
  3. Log in with the new password
  4. Delete the file immediately

⚠️ User ID 1 is usually the main admin account—verify if unsure.

⚠️ Troubleshooting Tips

  • Wrong table name? Check $table_prefix in wp-config.php
  • Multiple admins? Make sure you’re resetting the correct user
  • Login loop? Clear:
    • Browser cache
    • WordPress cache plugins
    • CDN cache (e.g., Cloudflare)

🧠 Best Practice Going Forward

  • Configure SMTP so email resets work reliably
  • Use a password manager
  • Enable multi-factor authentication (MFA)
  • Avoid using the default admin username

✅ Recommendation

  • Have SSH access? Use WP-CLI
  • No SSH? Use the database method
  • Email working? Use built-in reset

Avoid relying solely on email unless you’ve confirmed it’s properly configured.

If you manage multiple WordPress sites, it’s worth standardizing on WP-CLI and proper SMTP configuration to prevent future lockouts.

Comments

Leave a Reply

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