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
If your email system is working correctly, this is the fastest method.
Steps:
- Go to your login page: https://yourdomain.com/wp-login.php
- Click âLost your password?â
- Enter your username or email
- 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 yourwp-config.phpfile 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:
- Upload the file to your WordPress root directory
- Visit: https://yourdomain.com/reset-password.php
- Log in with the new password
- Delete the file immediately
â ď¸ User ID
1is usually the main admin accountâverify if unsure.
â ď¸ Troubleshooting Tips
- Wrong table name? Check
$table_prefixinwp-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
adminusername
â 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.

