Account recovery guide
Reset an authorized WordPress password safely.
Choose the least invasive recovery method first. Touch the database only when normal recovery and WP-CLI are unavailable.
Choose the safest available path
A lost password does not automatically require database access. The normal reset route preserves WordPress’s intended controls and leaves less room for a typo to affect the wrong account.
Email reset
Use “Lost your password?” at the login screen when the account can receive email. This is the preferred path.
WP-CLI
With authorized shell access, run wp user update <user> --user_pass='new-password'. WordPress writes the right format.
phpMyAdmin
Use this fallback only when email and shell recovery are unavailable but authorized database access exists.
Before opening phpMyAdmin
Record the site URL, database name, and a fresh backup location. Check wp-config.php if you need to identify the configured database or table prefix. The users table is often named wp_users, but installations commonly use a different prefix such as client_users or wpx9_users.
- wp_posts
- wp_options
- wp_users
- wp_usermeta
- wp_terms
- wp_comments
A custom prefix shifts every name the same way. If _users isn't visible in the list, see finding the WordPress users table before continuing.
Decide which authorized account you are restoring before making the change. Confirm the account by user_login or email—never by a vague memory of its row position.
phpMyAdmin recovery, step by step
- 01Open the correct database.
From the hosting control panel, open phpMyAdmin and select the database used by the WordPress site.
- 02Find the users table.
Locate the table ending in
_users, then browse it and find the authorized account by login or email. Unsure which table that is? See finding the WordPress users table. - 03Edit only
user_pass.Open the account row and replace the existing value in the
user_passfield. Leave the username, email, role-related metadata, and other fields unchanged. - 04Choose a compatible recovery value.
For a current WordPress installation, generate a local
$wp$2y$hash. For a one-time emergency fallback, phpMyAdmin’s MD5 function remains compatible with WordPress legacy verification. Do not use an arbitrary online hash format — see the hash formats guide if you're unsure which one a target site expects. - 05Save, sign in, then rotate again.
Before saving, you can check the hash format locally to catch a typo. Test the new password immediately. Once access is restored, set a fresh password through WordPress so the site follows its normal password workflow.
Every other field in this row stays exactly as it was — user_pass is the only value this recovery touches.
The Function column, and the one dropdown that ruins this
phpMyAdmin's row editor puts a Function dropdown beside every field. It applies a MySQL function to whatever you typed before storing it, and on user_pass that is either exactly what you want or a silent way to lock yourself out — because the row still saves successfully either way.
$wp$2y$ hashLeave it empty. The value is already hashed.The whole string, $wp$ prefix included.MD5.The plain-text temporary password, not a hash.SHA1, PASSWORD, or ENCRYPT.WordPress cannot verify any of those formats.Choosing MD5 while pasting a $wp$2y$ hash hashes the hash: a 32-character value that verifies against nothing. Leaving the function empty while typing a plain password stores the password in clear text, which fails to verify and leaves the real password sitting in the database. If you are unsure which of the two you just did, paste the saved value into the hash checker — it names the format in one look.
Prefer the SQL tab? The exact statements
The row editor and the SQL tab do the same thing. A statement is easier to review before you run it, and easier to get catastrophically wrong, so it comes with one rule: write the WHERE clause first, and prove it with a SELECT before you turn it into an UPDATE.
-- Run this FIRST. Whatever it returns is exactly what the -- UPDATE below will change. One row means you are safe to continue. SELECT ID, user_login, user_email, LEFT(user_pass, 7) AS hash_prefix FROM wp_users WHERE user_login = 'admin';
Swap wp_users for this site's actual table if the prefix is not wp_, and match on user_email instead if two accounts share a similar login. If that query returns nothing, you are in the wrong database — stop and read finding the WordPress users table rather than loosening the condition until something comes back.
-- Paste a hash you generated; keep the WHERE clause and the LIMIT. UPDATE wp_users SET user_pass = '$wp$2y$10$PASTE_YOUR_GENERATED_HASH_HERE' WHERE user_login = 'admin' LIMIT 1;
-- Emergency fallback only, when you cannot generate a proper hash.
-- Sign in immediately, then change the password inside WordPress.
UPDATE wp_users
SET user_pass = MD5('a-temporary-password')
WHERE user_login = 'admin'
LIMIT 1;
On a site with customers, subscribers, or a second administrator, that is a far bigger incident than the lockout you started with — and it cannot be undone without the backup you were told to take. The LIMIT 1 in these statements is a seatbelt, not a substitute for the WHERE.
phpMyAdmin reports 1 row affected on success. 0 rows affected means the WHERE clause matched nothing — or matched a row that already held that exact value — so check the login before running it again.
Why a manual hash can fail
The most common causes are selecting the wrong users table, editing a similarly named account, using a table prefix that does not belong to this site, or pasting a hash format that the installation does not expect. WordPress 6.8+ stores $wp$2y$ for new default bcrypt hashes, not plain $2y$.
Plugins can customize authentication, and WordPress multisite or external identity systems can add further constraints. If the account still cannot sign in after a confirmed change, stop making repeated database edits and investigate the site’s authentication plugins, role mapping, and error logs.
After access is restored
- Change the password again in the WordPress dashboard and store it in a password manager.
- Confirm the account has the intended role; do not create a permanent emergency administrator.
- Remove temporary recovery code, exports, and any copies of the password or hash.
- Review email delivery, backup access, and two-factor authentication so the next recovery does not require database access.
Quick answers
Which hash format should I paste on WordPress 6.8 or later?
A $wp$2y$ bcrypt hash — the same format WordPress Core creates itself. Pasting a plain $2y$ bcrypt or MD5 value will not verify, because Core expects its own SHA-384 pre-hash step first. Generate the correct value locally rather than guessing.
Do I need to log the user out first?
No. Editing user_pass directly does not by itself end existing sessions — WordPress checks the password only at login, not on every request. If you specifically want to force a logout, rotate the site's salts instead; that invalidates every session immediately.
Is it safe to use MD5 as the recovery hash?
Only as a one-time emergency fallback, immediately followed by a real password change after signing in. WordPress still verifies MD5 for backward compatibility, but it is far weaker than bcrypt and should never be left in place.
What if I can't find a table ending in _users?
Check wp-config.php for $table_prefix — a custom or migrated install may use something other than wp_, and multisite networks name subsite tables with a numeric suffix. See the users-table guide for the full naming rules.
Which row is the administrator?
Not necessarily ID 1 — that is only the first account ever created, which on a migrated or handed-over site is often a disabled or renamed one. Match on user_login or user_email instead, and confirm the role in the usermeta table: the row whose meta_key ends in _capabilities holds a serialized value naming the role, such as administrator.
What if the site has two administrator accounts?
Reset only the one whose email address you control, so you can complete a normal password change afterwards. Changing both doubles the blast radius for no benefit, and a second admin you do not recognise is worth investigating before you touch anything — an unexplained administrator is a compromise signal, unlike an unfamiliar hash format.
Do I need to clear a cache after changing the hash?
Page caches are irrelevant — the login check never reads them. A persistent object cache such as Redis or Memcached can be, because WordPress caches user objects there; flush it if a correct password is still refused. Existing login cookies are unaffected either way, since they are signed with the site's salts rather than the password.
Primary reference: WordPress Learn: what to do when you forget your password.