How to Recover Forgotten WordPress Username or Password

wordpress password recoveryforgot wordpress usernamereset wordpress password via phpmyadminwordpress sql password resetrecover wordpress admin access
Published·Modified·

Some users may forget their WordPress username or password after not logging in for a long time. There is no need to worry; if you have database access, recovering your credentials is straightforward.

1. Just Forgot the Username

Log in to phpMyAdmin, find your website's database, and locate the wp_users table. The user_login field contains the username. Alternatively, you can execute the following SQL statement to view the first 30 usernames:

SELECT * FROM `wp_users` LIMIT 0 , 30;

SQL Info

SQL User Data

2. Forgot the User Password

Method 1: Use the Login Page

The simplest way to reset a forgotten password is to click the "Lost your password?" button on the WordPress login page. Enter your username or email address. If you have forgotten both, refer to the steps above to find your username. After submission, you will receive an email with a password reset link. If your hosting does not support the mail() function, you may need to use SMTP to send emails.

Forgot Password

Figure 2-1: Forgot Password

Method 2: Modify Password via phpMyAdmin

If the above method fails, log in to phpMyAdmin, find the wp_users table, and modify the user_pass field to 21232f297a57a5a743894a0e4a801fc3. Since WordPress uses MD5 encryption for passwords, this will reset your password to admin. Please change the password immediately after logging in.

Modify Password

Figure 2-2: Modify Password

Update Password Using SQL

UPDATE wp_users SET user_pass = '21232f297a57a5a743894a0e4a801fc3' WHERE id = 1;

Note: Change the id to the one you found earlier. After updating, the password will be set to admin.