Locked out of your WordPress dashboard and the “Lost your password?” email never arrives? You can reset the password directly in the database using phpMyAdmin (available in cPanel, Hostinger hPanel and most hosts). This guide covers the new password format introduced in WordPress 6.8.
What changed in WordPress 6.8
For many years WordPress stored passwords with the phpass library, producing hashes that start with $P$B. Since version 6.8, WordPress uses bcrypt. New hashes start with $wp$2y$. In short, WordPress first applies HMAC-SHA384 to the password and then hashes the result with bcrypt, which is much slower for attackers to crack.
Old $P$ hashes still work: WordPress accepts them and quietly upgrades them to bcrypt the next time the user logs in. Older tutorials telling you to put an MD5 hash in the database are outdated and should be avoided.
Before you start
- Back up your database. In phpMyAdmin, use Export to download a copy.
- Find your table prefix. It is usually
wp_, but check$table_prefixinwp-config.php. - Know the username (
user_login) of the account to reset.
Step 1: Generate the hash
- Open the WordPress Password Hash Generator.
- Type a new password, or click Random strong password. Save it in your vault straight away.
- Choose WordPress 6.8+ (bcrypt). Use “Older WordPress (phpass)” only for sites running 6.7 or earlier.
- Enter the username and table prefix, then click Generate hash.
The tool runs in your browser, so the new password is never sent to our server. It gives you the hash and a ready-made SQL query.
Step 2: Run the query in phpMyAdmin
- Open phpMyAdmin and select your WordPress database.
- Click the SQL tab.
- Paste the generated query, which looks like this:
UPDATE `wp_users` SET `user_pass` = '$wp$2y$10$...' WHERE `user_login` = 'admin'; - Click Go. You should see “1 row affected”.
Prefer clicking? Open the wp_users table, edit the user’s row, paste the hash into user_pass and save. Make sure the Function dropdown is left empty, not MD5.
Step 3: Log in and tidy up
- Log in at
/wp-login.phpwith the new password. - Check Users for admin accounts you don’t recognise. An unexpected lockout can be a sign of a hack.
- Update WordPress, themes and plugins, and turn on two-factor authentication.
Troubleshooting
- “0 rows affected”: the username or table prefix is wrong.
- Still can’t log in: clear your browser cookies, and check that a security plugin hasn’t locked your IP.
- Hash looks wrong after saving: make sure phpMyAdmin did not apply MD5 or trim the value.
FAQ
Can I use a bcrypt hash from another generator?
A plain bcrypt hash ($2y$) works in WordPress 6.8+ too, but the $wp$ format is what WordPress itself creates, so it is the best choice.
Is it safe to generate a WordPress hash online?
Only if the tool works locally in your browser, like ours. Avoid tools that send your password to a server.