There was a problem loading the comments.

How to Reset a Lost WordPress Admin Password (3 Methods)

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

Quick answer: Reset a lost WordPress admin password three ways: the standard Lost your password link, editing user_pass in phpMyAdmin with the MD5 function, or adding a temporary admin user via functions.php. Use the first method that works, then set a strong password once you are back in.

Locked out of WordPress admin with no working password reset email? You can regain access three ways, from easiest to most technical. Use the first one that fits your situation.

Method 1: The standard reset link

On the login page click Lost your password?, enter your username or email, and follow the link that arrives. If the email never comes, the site cannot send mail (a separate issue worth fixing), so move to the next method.

Method 2: Reset through phpMyAdmin

Open phpMyAdmin from your control panel, select the WordPress database, and open the wp_users table (the prefix may differ). Edit your user row, and in the user_pass field set a new value, choosing MD5 from the function dropdown so WordPress can read it:

Field:    user_pass
Function: MD5
Value:    your-new-password

Save, then log in with the new password. WordPress re-hashes it securely on first login.

Method 3: Add an admin user via functions.php

If you cannot reach phpMyAdmin but can edit files, add this to your active theme's functions.php temporarily:

add_action('init', function () {
    $user = 'newadmin';
    $pass = 'StrongPass123!';
    $email = 'you@yourdomain.com';
    if (!username_exists($user)) {
        $id = wp_create_user($user, $pass, $email);
        $u = new WP_User($id);
        $u->set_role('administrator');
    }
});

Load any page of the site once so the code runs, log in as the new admin, then remove the snippet immediately so it does not recreate the account or sit in your theme.

After you are back in

Set a strong unique password, confirm the admin email is correct, and check that no unexpected admin users exist - an unfamiliar admin account can be a sign of compromise.

Frequently asked questions

The reset email never arrives - what now?
Use phpMyAdmin to set a new password, or add an admin user via functions.php; the missing email means the site cannot send mail.

Is editing the database safe?
Yes, if you set user_pass with the MD5 function; WordPress re-hashes it securely on first login.

If you host with SoftSys managed WordPress hosting, our support team can verify your identity and restore admin access for you, so you are never truly locked out.


Share via
Did you find this article useful?  

Related Articles

Tags

© Softsys Hosting