Forgot Your WordPress Admin Password? Here's How to Get Back In


If you run an indie e-commerce site on WordPress, you’ve definitely hit this headache: you want to log into the admin to update products or handle orders, and — boom — you forgot the password!

Especially when your password was auto-filled by the browser. Switch computers or clear the cache and suddenly you’re locked out. The backend is unreachable, the site might as well be “offline”, and you’re spinning in circles.

Don’t panic — I fell into this exact trap when I started. Today, as someone who’s been there, I’ll share several password recovery methods I’ve personally verified, from the simple to the “technical” — one of them will fit you.

Method 1: The Standard Move — “Lost your password?”

This is the simplest, most direct method, and the first one you should try.

On your WordPress login page (usually your-domain.com/wp-admin), you’ll see a “Lost your password?” link.

WordPress login page

Click it, enter your admin username or the email you registered with. The system sends a password reset email to your inbox. Click the link in the email and you can set a new password.

Pros: Simple, fast, safe. Cons: If you forgot which email you registered with, or your site’s email sending (SMTP) was never configured properly, this won’t work.

If that fails, don’t worry — time for the big guns.

Method 2: The Nuclear Option — Edit the Database Directly

This one sounds a bit “hacker-ish”, but it’s actually simple and works almost 100% of the time. As long as you can access your hosting control panel (cPanel, BT Panel, etc.), the password is a non-issue.

The core idea: bypass WordPress and modify the password field directly in the database.

Using the most common cPanel as an example, here’s the whole flow:

Step 1: Find your database info

First, you need to know which database your WordPress site uses. That info lives in the wp-config.php file in your site’s root directory.

Use your hosting panel’s file manager, or an FTP tool, to find and open wp-config.php. You’ll see code like this:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'your_database_name' );

/** MySQL database username */
define( 'DB_USER', 'your_database_user' );

/** MySQL database password */
define( 'DB_PASSWORD', 'your_database_password' );

The DB_NAME is your database name — note it down.

Step 2: Log into phpMyAdmin

Back in your cPanel, find the “Databases” section and click the phpMyAdmin icon.

phpMyAdmin in cPanel

It’ll log you into the database management interface automatically.

Step 3: Find the users table and change the password

  1. In phpMyAdmin’s left sidebar, find the database name you noted and click it.
  2. On the right, you’ll see all the tables in that database. Find the one ending in _users — usually wp_users (your prefix may differ, but it always ends in _users). Click it.
  3. Now you see all the site’s users. Find your admin account’s row (usually user_login is the username you know, like admin). Click the “Edit” button on that row.

Editing the users table

  1. On the edit page, find the user_pass row. You’ll see a long string of gibberish — that’s the encrypted password. Here’s what we do:
    • In the Function column’s dropdown, select MD5.
    • In the Value column’s input box, type your new password directly, e.g. MyNewPass123!.

Modifying the password field

  1. Scroll to the bottom of the page and click “Go”.

Done! Now you can log into your WordPress admin with your new password MyNewPass123!.

Pros: Extremely high success rate — ignores all WordPress restrictions. Cons: Needs hosting panel access; be careful with the steps.

Method 3: The Tech Route — Via the functions.php File

If you can’t get into the hosting panel for some reason but still have FTP access to the site, try this one.

The principle: temporarily add a small snippet to your active theme’s functions.php file to reset the password.

Steps:

  1. Connect to your site’s server with an FTP tool (like FileZilla).

  2. Navigate to wp-content/themes/your-active-theme-folder/.

  3. Find functions.php, download it to your local machine as a backup first (good habits matter!).

  4. Open functions.php in a code editor (VS Code works, even Notepad).

  5. Right after <?php at the top of the file, add this code on a new line:

    wp_set_password('your-new-password', 1);

    Note:

    • Replace your-new-password with your actual new password.
    • 1 is the admin’s user ID. For most personal sites, the first admin account created has ID 1. If you’re not sure, this method may not apply.
  6. Save the file and upload it back to the server, overwriting the original.

  7. Now log into the WordPress admin with your new password.

  8. 【Important!】 After logging in, immediately go back to FTP and remove that line from functions.php! Otherwise the password resets on every page load — a serious security risk.

Pros: No database access needed — just FTP. Cons: Somewhat risky; if you paste the code in the wrong spot the site may break. You must clean up the code afterward!

Summary

Forgetting your password isn’t scary — not knowing how to recover it is. Here’s how to choose between the three methods:

  • First choice: Always try Method 1 (email recovery) first — simplest, no brainpower needed.
  • Nuclear option: If email fails, go straight to Method 2 (database edit) — most reliable, one-and-done.
  • Fallback: Only if you lack hosting panel access but have FTP, consider Method 3 (edit functions.php) — and remember to restore the file.

Finally, to avoid this whole ordeal in the future, I strongly recommend a solid password manager like 1Password or Bitwarden. Let it generate and remember all your complex passwords — safer and way less hassle.

Alright, hope this hands-on guide helps. Go get your site back!