If you lost or can’t remember your WordPress admin password, you can use several methods to reset it and we’ll cover them in this quick guide.
(Easy) lost your password link
The first method you should try if you’ve lost your password is to use the Lost your password? link on your WordPress website’s login page.
Head to https://yourdomain.com/wp-login.php (replace yourdomain.com with your actual domain name). Click the Lost your password? link below the login form:

This will take you to another form where you need to put in your username or your email address:

Once you fill in your username or email address, the password reset link will be sent to your email address, which you can click to go ahead and reset the password for the specified username.
(Medium) PHPMyAdmin password reset
This method is a bit more tricky, but not very complicated. To reset the admin password using the PHPMyAdmin application, log in to your cPanel control panel or your hosting control panel.
Under the Databases section, click the phpMyAdmin link:

Next, click on the desired database in the left frame:

Click on the wp_users table in the right frame (in this example, it’s called wphq_users as the prefix may vary):

Click the Edit button next to your admin username:

Paste or fill in your password in the Value field under the user_pass row, and select the MD5 option in the Function column. Click the Go button once ready to save changes.

(Advanced) password reset via theme file
This method is a bit more advanced as it requires an edit of the theme file.
Log in to your cPanel control panel.
Click the File Manager under the Files section:

Edit the functions.php file for your active theme. If your WordPress website is your main website, the example path is:
/home/username/public_html/wp-content/themes/your_theme/functions.php
In our example, the path is:
/home/username/public_html/test2/wp-content/themes/twentytwenty/functions.php
Select the functions.php file with your mouse, and click the Edit button in the top menu ribbon:

On the second line, right after the <?php opening tag, insert the following code:
wp_set_password(‘password’,’admin’);
Replace the following values:
password – your new password
admin – your admin username

Once ready, click the Save Changes button to save the changes.
Now you can log in to your WordPress dashboard with the temporary password you’ve set.
Change your password to the new password, and then remove line 2 from the functions.php file to avoid having your password reset each time you access your WordPress dashboard.
(Advanced) Emergency Password Reset Script
If none of the methods above work for you, you can try using the emergency password reset script.
There are a couple of caveats to using this script:
- You need to know your admin username
- It updates the admin password and sends it directly to the admin email address
- In case you can’t receive emails to your admin email address – the password is still reset
Save the script from the following article to an emergency.php file, and upload it to your WordPress root directory (where the wp-config.php file resides).
Once completed, visit the https://yourdomain.com/emergency.php URL (replace yourdomain.com with the actual domain name).
Fill in the administrator username and the new password, and click the Update Options button. You will then receive a success confirmation message and an email to the administrator’s email address.
Make sure to remove the emergency.php file from your account on the password reset is completed.