Skip to content
Tarisu Limited

WordPress admin password reset without email: WP-CLI, phpMyAdmin and locked-out recovery

A practical guide to regaining WordPress admin access when password reset emails fail. Use WP-CLI over SSH, a database query in phpMyAdmin, or an emergency login to restore control safely.

Guides 11 min read Tarisu Limited

WordPress admin password reset without email: WP-CLI, phpMyAdmin and locked-out recovery

If you cannot sign in to WordPress because the administrator password is lost, password reset email is not arriving, or your mailbox is inaccessible, this guide is for you. It focuses on restoring access to your own WordPress site on shared hosting, a VPS, or a dedicated server. You will see the safest order to try, exact commands for WP-CLI, a database method using phpMyAdmin, and what to do when the usual recovery route fails.

Before changing anything, make a backup. On WP-CLI hosts, export the database and keep a copy of wp-content. On shared hosting, use the control panel backup tool if available. A password change is usually small, but a wrong SQL statement or an emergency account can create a second problem.

What you need before you start

  • Access to the hosting control panel, SSH, or the hosting provider console for your own server.
  • The database name and user from wp-config.php if you must use phpMyAdmin.
  • A temporary password that is strong, unused, and not reused elsewhere.
  • A browser window or incognito window where you can test the WordPress login page.

If your site is on a Tarisu shared hosting plan, use the file manager or terminal tools available in the control panel. If you use a Tarisu VPS or dedicated server, use SSH when available, and the provider console if SSH is locked by a firewall. The commands below assume a typical Linux WordPress install, with notes for Windows where the same WP-CLI PHAR can be used.

Step 1: Identify the recovery route that fits your hosting

SituationBest first methodFallback
SSH access works and WP-CLI is installedWP-CLI user updateDatabase query
Control panel with phpMyAdminphpMyAdmin SQLCreate emergency user through database
Only file accessCheck wp-config.php and ask host for database accessUse a temporary maintenance script only if you control the server

Do not use a public password reset page or an online hash generator if the site is public and the details are sensitive. Keep the temporary password private until you sign in.

Step 2: Try the normal reset once

Before direct database work, use the standard WordPress login screen. Choose Lost your password?, enter the administrator email, and check spam folders. If the email arrives, follow the link and finish the reset. If it does not arrive, do not keep sending it; check the mail logs or move to a direct method.

If the site sends email through SMTP but mail delivery is failing, you can still regain access with the methods below. After you sign in, test mail and repair SMTP settings if customers need password emails.

Step 3: Back up the database and files

If WP-CLI is available, run these commands from the WordPress root directory. Replace /var/www/html with your site path if it differs.

cd /var/www/html
wp db export pre-reset-backup.sql --allow-root
wp user list --role=administrator --fields=ID,user_login,user_email --allow-root

You should see a list of administrator users. The ID and login are what you need for the next step. If you see an error about memory, rerun with a higher PHP memory limit, for example:

php -d memory_limit=512M wp user list --role=administrator --allow-root

If you do not have WP-CLI, use the hosting backup tool. On shared hosting, download a database backup before running SQL. On a VPS, a file-level snapshot can help, but a database export is still useful because you may need to inspect user tables.

Step 4: Reset the administrator password with WP-CLI

WP-CLI is the cleanest method because WordPress creates a proper password hash and keeps the rest of the account intact. Run the following from the WordPress root. Use a temporary password with no spaces or shell-sensitive characters for the simplest copy-paste experience.

wp user update admin --user_pass='TempPass123!' --allow-root

If the administrator login is not admin, replace it with the value from the user list. You can also use the numeric ID:

wp user update 1 --user_pass='TempPass123!' --allow-root

A normal success message confirms the user was updated. Open the WordPress login page in a private browser window and sign in with the temporary password. Change the password from the profile screen immediately. If you use two-factor authentication, complete the second factor after the new password is accepted.

Windows Server 2019 and 2022 notes

If WordPress runs on Windows with PHP and a WP-CLI PHAR file, open PowerShell, move to the site root, and run the PHAR through PHP. For example, if the site root is C:/inetpub/wwwroot and the PHAR is in that folder:

cd C:/inetpub/wwwroot
php wp-cli.phar user list --role=administrator
php wp-cli.phar user update admin --user_pass='TempPass123!'

On Windows 10 or 11 used as a local development machine, the same command pattern applies if you use PHP and a local web stack. The important part is running WP-CLI against the correct WordPress installation, not the parent folder.

Step 5: Reset through phpMyAdmin when WP-CLI is unavailable

This method edits the users table directly. It is safe when you use the correct table prefix and change the password through WordPress afterwards. In cPanel, Plesk, or another control panel, open phpMyAdmin, select the site database, and open the SQL tab.

First, confirm the administrator row. Replace wp_ with your real table prefix if it is different, such as wp2_.

SELECT ID, user_login, user_email FROM wp_users WHERE user_login = 'admin';

If the row exists, set a temporary MD5 password. MD5 is not a modern password format, so treat it as a short recovery step only.

UPDATE wp_users SET user_pass = MD5('TempPass123!') WHERE user_login = 'admin';

You should see a confirmation that one row was affected. Sign in at the WordPress login page, then change the password in the user profile so WordPress stores a current hash. If the login still fails, do not repeat MD5 blindly; continue to the troubleshooting section.

Step 6: Create an emergency administrator if the account is damaged

If the administrator row is missing, disabled, or tied to an email you cannot access, create a temporary administrator instead. Use a new email address that you control.

wp user create recovery [email protected] --role=administrator --user_pass='TempPass456!' --allow-root

You should see a success message with the new user ID. Sign in as recovery, repair the original account, and then remove the emergency user. To remove it after you are back in control:

wp user delete recovery --reassign=1 --yes --allow-root

The --reassign=1 option moves posts owned by the emergency user to another user. Replace the ID with the administrator you want to keep. If you are unsure, skip deletion until you have confirmed which account holds important content.

Step 7: Secure the site after recovery

  1. Change the administrator password from the WordPress profile page.
  2. Check the list of administrators and remove unknown accounts.
  3. Review two-factor authentication settings and any application passwords.
  4. Test password reset email from the login screen.
  5. Update WordPress, themes, and plugins, then review security plugins if lockouts continue.

If a security plugin, firewall, or fail2ban service blocked login attempts, check its logs before weakening protection. A temporary allow of your own IP address is better than disabling protection site-wide. If SSH is also blocked, use the console provided by your hosting provider or server provider.

Troubleshooting common errors

wp: command not found

WP-CLI may be installed under a different name. Try php wp-cli.phar --info in the WordPress root. If it is missing and you administer the server, you can install it for one user or system-wide. A simple per-user install on Ubuntu 22.04, Ubuntu 24.04, Debian 12, or AlmaLinux 9 is:

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar

If you need a system-wide command and have sudo, move it into place:

sudo mv wp-cli.phar /usr/local/bin/wp
sudo chmod +x /usr/local/bin/wp
wp --info

On shared hosting without shell access, use phpMyAdmin instead of installing WP-CLI.

Error establishing a database connection

This usually means wp-config.php has the wrong database host, database name, user, or password. Open wp-config.php through your control panel file manager and compare the DB_ values with the database details shown in the hosting panel. Do not edit them blindly if the site is live. A quick check with WP-CLI is:

wp config get DB_NAME --allow-root
wp config get DB_HOST --allow-root

If these commands fail, WP-CLI is not reaching the database. Repair the credentials first, then retry the password update.

SQL error or wrong table prefix

If phpMyAdmin returns a syntax error, check that the SQL ends with a semicolon and that the table name matches your prefix. A multisite network or custom install may use wp_2_users, not wp_users. Browse the database table list before running an update. Never run an UPDATE without a WHERE clause on the users table.

MD5 login works once but the site still rejects the password

This can happen if a security plugin changes login behavior, if the account is not an administrator, or if the browser is caching an old page. Sign in with the MD5 password, immediately change it in the profile page, and check that the account role is administrator. If the profile page is inaccessible, use WP-CLI:

wp user list --role=administrator --fields=ID,user_login,user_email --allow-root
wp user update admin --user_pass='TempPass123!' --allow-root

A plugin or theme locks you out

If WordPress shows a plugin error or a custom lockout page, temporarily disable the suspect plugin. With shell access, rename its folder in wp-content/plugins. Use the exact folder name from the filesystem, not a guess.

cd /var/www/html
mv wp-content/plugins/security-plugin wp-content/plugins/security-plugin.disabled

After you sign in, reactivate or replace the plugin and review its lockout settings. If you cannot rename folders, use the hosting file manager to rename the plugin folder.

Two-factor authentication blocks the reset

A password reset does not always complete a second factor. If a two-factor plugin is preventing sign-in, disable it temporarily through WP-CLI if the command is available for that plugin, or rename its plugin folder as described above. After recovery, remove the old second factor and set up a new one with backup codes.

Windows paths and PowerShell

On Windows, use the correct path to the WordPress root. If WP-CLI is not on PATH, call it through PHP:

cd C:/inetpub/wwwroot
php wp-cli.phar core is-installed
php wp-cli.phar user list --role=administrator

If the path contains spaces, wrap the path in single quotes in PowerShell, for example cd 'C:/inetpub/wwwroot'.

Security notes

Password recovery is a high-value moment for attackers. Use a temporary password that is unique, change it immediately, and avoid pasting passwords into chat tools or public tickets. If you ran an SQL command with a password in phpMyAdmin history, consider rotating any exposed credentials. Do not leave an emergency administrator account active. Do not keep a file with database exports or hashes in a public web folder. If you use a Tarisu VPS or dedicated server, confirm that your firewall and console access remain restricted to your own sessions.

Keep backups before every recovery attempt. A backup lets you compare the users table, restore a clean state if a query fails, and avoid making a small lockout into a full site incident. If your site handles customer accounts, review user roles after recovery and confirm that only intended administrators have elevated access.

Frequently asked questions

Can I reset the password from the WordPress login page without email?

Usually no. The standard link sends a message to the account email. If email delivery is broken, use WP-CLI or phpMyAdmin. If you can change the email in the database, you can receive the link again, but direct password update is often faster.

Which method should I use on shared hosting?

If your host offers phpMyAdmin, use it with the correct table prefix. If the host offers a terminal, WP-CLI is cleaner. Avoid installing server-wide tools if the plan does not allow shell access.

Is MD5 safe for WordPress passwords?

WordPress can accept older MD5 hashes for backward compatibility, but new logins should use the normal WordPress hash flow. Treat MD5 as a temporary bridge: sign in once, change the password in the profile screen, and confirm the stored hash is updated.

What if I have multiple administrators?

List them with WP-CLI or in phpMyAdmin, reset only the account you need, and then review all administrator accounts. Remove unknown users after you are back in control.

Will resetting the password fix a hacked site?

Not always. A password reset restores access but does not remove malware, rogue administrators, or altered plugins. After regaining access, review users, plugins, themes, and server logs, and clean the site before trusting it.

What if my server is also locked?

Use the console or remote access method provided for your own machine. If the hosting provider gives a VNC or serial console, use it to repair SSH or firewall rules. Keep backups and change passwords only after you confirm you are on the correct server.

Related posts

We use strictly necessary cookies to keep you signed in and remember your preferences. We would also like to measure how the site is used, but only with your agreement. Read our privacy policy