What this problem is
If you cannot log in because the admin password is unknown or the reset email does not arrive, you can set a new password from the database.
Why it happens
- Password was changed and not documented
- Email delivery issues prevent reset links
- Admin account was modified after a migration
Prerequisites
- Hosting control panel access
- phpMyAdmin access to the WordPress database
- Know your WordPress database table prefix (often
wp_)
Diagnosis
Confirm you are editing the correct database by checking DB_NAME in wp-config.php.
Detailed steps
Step 1) Open the users table
In phpMyAdmin, open {prefix}users (example: wp_users).
Step 2) Find the admin user
Locate the row for the username or admin email.
Step 3) Set a new password using MD5
- Click Edit on the user row.
- In the
user_passfield, type a new temporary password. - In the function dropdown for
user_pass, chooseMD5. - Save.
Expected result: you can log in with the new password immediately.
Step 4) Change the password again from WordPress
After logging in, go to Users > Profile and set a strong password. WordPress will re-hash it with modern algorithms.
Expected results
- Access recovered to the admin account
- Password stored with modern hashing after you change it in wp-admin
What to do if it fails
- If login still fails, verify the table prefix and that you edited the correct user row
- Check if a security plugin blocks logins by IP
- Confirm cookies are enabled and you are using the correct login URL
Best practices
- Use a temporary password when setting MD5 and change it right after login
- Limit phpMyAdmin access and use strong hosting passwords
- Enable 2FA for admin users