If you can't log into WordPress, the fastest fix is usually the built-in password reset link. If email isn't working or you don't have access to the account's inbox, you can reset the password directly through the database instead.
Method 1: Reset via Email
- Go to your site's login page (usually yoursite.com/wp-login.php) and click Lost your password?
- Enter the username or the email address linked to the admin account.
- Check that inbox for a reset link and follow it to set a new password.
This only works if the email address on the account still receives mail and outgoing email is functioning correctly on the site, which isn't always the case if the site's mail settings were never configured.
Method 2: Reset via phpMyAdmin
If email reset isn't an option, you can update the password directly in the database using phpMyAdmin.
In cPanel
- Log into cPanel and open phpMyAdmin under the Databases section.
- Select your WordPress database, then open the wp_users table.
- Click Edit on the admin user's row.
- In the user_pass field, enter your new password, and set the function dropdown next to it to MD5.
- Click Go to save.
In DirectAdmin
- Log into DirectAdmin and open phpMyAdmin from the MySQL Management section.
- Select your WordPress database, then open the wp_users table.
- Click Edit on the admin user's row.
- In the user_pass field, enter your new password, and set the function dropdown next to it to MD5.
- Click Go to save.
Log in with the new password immediately afterward to confirm it worked.
Do not skip setting the function to MD5. If you save the password as plain text, WordPress won't recognize it and you'll still be locked out.
Method 3: Temporary Code Snippet
If you have file access but not database access through a graphical tool, you can add a temporary line to your active theme's functions.php file:
wp_set_password('your-new-password', 1);
The number 1 refers to the user ID, which is usually 1 for the original admin account but can differ if you're not sure. Load any page on the site once to trigger the change, then remove the line immediately. Leaving it in place would let anyone reset that account's password just by loading the site.
If You Can't Access Any of These
If you don't have hosting login details either, you'll need to recover access to your hosting account first before any of these methods are possible.