The normal way to reset a WordPress password is the “Lost your password?” link. But if email is broken on the site, you can be locked out completely. When that happens, you can set a new password directly in the database. Here is how to do it safely.
How WordPress stores passwords
WordPress never stores your plain password. It stores a one-way hash in the user_pass column of the wp_users table. Older versions use phpass; WordPress 6.8 and later use bcrypt. Crucially, WordPress also recognizes a legacy MD5 value and upgrades it to a secure hash the next time you log in. That legacy path is what makes a manual reset simple and version-proof.
Reset it in three steps
- Open the WordPress Password Hash Generator and type your new password. It produces the hash and a ready SQL statement in your browser, so nothing is sent anywhere.
- Open your database tool (phpMyAdmin, Adminer, or the command line).
- Run the generated SQL, or paste the hash value into the
user_passfield for your user. Adjust the table prefix if it is notwp_.
The SQL looks like this:
UPDATE `wp_users` SET `user_pass` = 'THE_HASH' WHERE `user_login` = 'admin';
Log in with the new password. WordPress quietly replaces the value with a secure hash on that first login.
Stay safe
- Only do this on a site you own or administer.
- Use a strong, unique password.
- Take a quick database backup before editing, in case you change the wrong row.
- Fix the underlying email problem afterward so the normal reset works next time.
Other ways in
If you have FTP or file access but not database access, you can also reset by adding a temporary wp_set_password() call in functions.php, then removing it. The database method above is usually faster when you have phpMyAdmin.
Related tools
- Generating strong passwords for the new login? Use the Password Generator.
- Rotating your security keys while you are in there? See the WordPress Salt Generator.
- Hardening the site afterward? Try the wp-config Generator.
Type the password, run the SQL, log in. WordPress upgrades the hash automatically, and you are back in.