Forgot your WordPress admin password? If you have SSH or terminal access to your cPanel server, you can quickly reset it using the MySQL command line. Follow these steps to regain access to your WordPress dashboard.

Step 1: Find the WordPress Database Name

First, locate the database used by WordPress for your domain:

  • Navigate to your website’s root directory.
  • Open the wp-config.php file.
  • Look for the following line:
define('DB_NAME', 'your_database_name');

Take note of the database name, as you’ll need it in the next step.

Step 2: Access the MySQL Database

Log into MySQL from the command line:

mysql

Once inside MySQL, select the WordPress database:

mysql> USE your_database_name;

Step 3: View WordPress Users

To see a list of users and their hashed passwords, run:

mysql> SELECT ID, user_login, user_pass FROM wp_users;

This will display a table similar to the one below:

+----+------------+--------------------------------+
| ID | user_login | user_pass                      |
+----+------------+--------------------------------+
|  1 | admin     | $P$B05GJOhuMCFlxtYsYjA8P/sX0svNw81 |
+----+------------+--------------------------------+

Step 4: Reset the WordPress Admin Password

Update the password for the desired user:

mysql> UPDATE wp_users SET user_pass = '2886b319b37e797234026d279bafd745' WHERE ID = 1;

Step 5: Verify the Password Update

Check if the update was successful:

mysql> SELECT ID, user_login, user_pass FROM wp_users WHERE ID = 1;

The output should display the new password hash.

Step 6: Generate an MD5-Encrypted Password

WordPress uses MD5 hashing for passwords. You can generate a new MD5 hash using an online tool:

MD5 Hash Generator

Alternative Method: Reset WordPress Password via Email

If you have email access, try resetting your password via:

  • Go to yourdomain.com/wp-admin.
  • Click Lost your password?.
  • Enter your admin email and follow the reset link.

Need Help?

If you’re unable to reset your password, UnderHost’s support team is available 24/7. Contact us at @CustomerPanel for assistance.