How to recover WordPress Admin password?

In this post

  • Password recovery feature
  • phpMyAdmin
  • FTP Account
  • PHP Script

If you forget your admin password, follow these steps to recover WordPress admin password!

Method 1. Use the password recovery feature

Only applies when hosting does not turn off the mail function. If hosting is turned off, you will not receive a recovery email.
So, if you do not receive the email, ask the hosting provider to turn it on.

Visit the wordpress login page under the link: example.com/wp-admin or wpcodeless.com/wp-login.php

with: example.com is your domain name

recover-admin-password-1-min

Click Lost your password?

Enter your username or email address and click Get New Password.

recover-admin-password-2-min

Check your email

recover-admin-password-3

Only applies when hosting does not turn off the mail function. If hosting is turned off, you will not receive a recovery email.
So, if you do not receive the email, ask the hosting provider to turn it on.

Method 2. Create a new password in phpMyAdmin

If you have a hosting account, sign in.

log-in-cpanel-hosting-1

Find Databases and click on phpMyAdmin

log-in-cpanel-hosting-2

Select the Database of your website, and look for the WP_USERS line

recover-admin-password-4

Find your username, and select Edit

recover-admin-password-5

In field 1, type your new password. In field 2, select MD5

recover-admin-password-6-min

Click Go

recover-admin-password-7-min

Done

Method 3. Create new password with FTP Account

If you do not have a Hosting account, only FTP account, you can do the following:

Open File Zilla, download File Zilla at: https://filezilla-project.org/download.php?type=client

file-zilla-1-min

Find the functions.php file at wp-content/themes/your-theme/functions.php

functions-php-min

Insert the following code at the end of functions.php

wp_set_password( ‘[email protected]’, 1 );

with [email protected] is your new password, and 1 is your admin account ID.

Try signing in again. If successful, remove the code above.

If you login error. Please delete the above code and log back in

Method 4. Use PHP Script

Create a file  long.php in the website directory with the following content:

recover-admin-password-8-min

Content in this link: https://gist.github.com/khunglongwp/86bb3a99c94ea5f7716a240ef5e72d88

Open link: example.com/long.php

with example.com is your domain name.

Enter Username and New Password

recover-admin-password-9

Try signing in with this new password. If successful, delete the long.php file to prevent others from changing your password ^^

Share this post:

Leave a Reply

avatar
  Subscribe  
Notify of