Resetting a WordPress password via phpMyAdmin database editor

3 Ways to Reset Your WordPress Password

Last modified: June 18, 2026

Fiverr freelancers

Losing access to your WordPress site happens more than most people expect. Forgotten credentials, a hacked account, or a server that won’t send email can all leave you locked out of the admin panel. If clicking “Lost your password?” on the login page produces no reset email, the two methods below let you bypass WordPress’s email system and reset your credentials directly on the server.

Both methods require access to your hosting environment through your host’s control panel (cPanel or Plesk) or via FTP. Either approach gets you back in without waiting for an email.

Why WordPress Password Reset Emails Don’t Arrive

The most common cause is that most shared hosting servers rely on PHP’s built-in mail function, which email providers frequently block as spam. Some managed hosts disable PHP mail entirely for security reasons. When this happens, WordPress fires off the reset email, the server appears to send it, and the message either lands in a spam folder or disappears silently.

After you regain access using one of the methods below, the permanent fix is to install an SMTP plugin like WP Mail SMTP. This routes WordPress’s outgoing emails through a proper mail service (Gmail, Outlook, or a transactional provider like Mailgun or SendGrid), so reset emails and admin notifications reliably reach their destination. Without this fix, you risk getting locked out again the next time you need a password reset. If emails are landing in spam even after setting up SMTP, also check that your domain has an SPF record pointing to your mail provider, as missing SPF records cause transactional email to fail at the recipient’s spam filter before SMTP routing makes any difference.

What You Need Before Starting

For the phpMyAdmin method: access to your hosting control panel (cPanel, Plesk, or similar) with phpMyAdmin available under the Databases section. For the functions.php method: FTP credentials or access to your host’s File Manager in cPanel. You do not need your existing password to use either method.

Show More

* This button will show the rest of the post and open up an offer from a vendor

Reset your Password in phpMyAdmin

phpMyAdmin is a web-based database manager available through most hosting control panels under “Databases.” This method directly overwrites the password field in your WordPress database, bypassing the email system entirely.

  1. Log in to your hosting panel (cPanel, Plesk, or similar) and open phpMyAdmin
  2. Select your WordPress database from the left panel , the name matches what’s set in your wp-config.php file
  3. Click the wp_users table
  4. Find your user account row and click Edit
  5. In the user_pass row, open the Function dropdown and select MD5 , WordPress stores passwords as MD5 hashes, so choosing this ensures your plain-text input gets encoded correctly before saving
    selecting MD5 function in phpMyAdmin user_pass field
  6. Clear the Value field and type your new password
    editing password in phpMyAdmin wp_users table
  7. Click Go to save the change
  8. Go to your login page (yourdomain.com/wp-admin) and log in with the new password
  9. Once inside the dashboard, go to Users → Profile and update your password to something stronger using WordPress’s built-in form

After you log in through the WordPress dashboard, WordPress automatically re-hashes the password using its own more secure algorithm. The MD5 step in phpMyAdmin is just a bridge to get the initial value into a format WordPress recognizes.

Add a New User Through functions.php

This approach adds a brand-new administrator account using a PHP snippet in your theme’s functions file , no database access required. You’ll need to reach your theme files via FTP, your host’s File Manager in cPanel, or a plugin like WP File Manager.

Open your active theme’s functions.php file (found in your theme’s root folder) and paste the following code at the very end:

function add_admin_account(){
  $user = 'temprecovery';
  $pass = 'Recov3r@2026!';
  $email = '[email protected]';
  if ( !username_exists( $user )  && !email_exists( $email ) ) {
    $user_id = wp_create_user( $user, $pass, $email );
    $user = new WP_User( $user_id );
    $user->set_role( 'administrator' );
  } }
add_action('init','add_admin_account');

Replace the username, password, and email with your own values. Save the file, then:

  • Visit any page on your site to trigger the function (even just loading the homepage works)
  • Go to your login page and log in with the username and password you set above
  • Remove the code from functions.php immediately after logging in , leaving it in place creates a security vulnerability since the credentials are stored in plain text in a file
  • Once inside, update your original account’s password from the Users screen, or delete the temporary account if you no longer need it

This method also works on local WordPress installations, making it useful for developers locked out of a development copy where email isn’t configured by default.

Method 3: WP-CLI (For Developers With Server SSH Access)

If your hosting plan includes SSH access, WP-CLI is the fastest reset method available. One command updates the password without touching the database or theme files:

wp user update your-username --user_pass='YourNewSecurePassword' --path=/path/to/wordpress

Replace your-username with your WordPress login name and set the --path flag to your WordPress root directory (check your SSH welcome message or hosting panel if you’re unsure of the path). After running the command, log in normally through /wp-admin. WP-CLI handles the password hashing automatically, so you don’t need to worry about MD5 or any encoding steps.

To list all users on the site first: wp user list --path=/path/to/wordpress. This shows the exact username and user ID to target if you’re not sure of the login name.

Final Thoughts

Both methods above work without relying on WordPress’s email system. Use the phpMyAdmin approach if you’re comfortable in your hosting control panel – it’s the most direct route to your database. Use functions.php if you prefer working with files, or if phpMyAdmin isn’t available through your host.

Once you’ve regained access, take a few minutes to update your password to something strong and verify that your WordPress admin email address is correct. Setting up a second administrator account as a backup is also a good habit – if one account gets locked out or compromised, you can still reach the dashboard through the other. If resetting your password doesn’t solve the issue and WordPress keeps logging you out automatically, see our guide on WordPress keeps logging you out for URL and session fixes. If you’re seeing the specific error “Could Not Save Password Reset Key To Database” during the reset flow, that’s a separate database write issue – our guide on the WordPress password reset key error covers all the causes and fixes.

Recap:
Save 4 Later
Email liked links to yourself

    Stay Updated with WordPress Insights

    Get the latest WordPress tips, theme reviews, and industry deals delivered to your inbox.