(WordPress)- How to reset the login password of WordPress website

(WordPress)- How to reset the login password of WordPress website

(WordPress)- How to reset the login password of WordPress website

Kimo, which was often used in the past, and now Yahoo intellectuals, also stopped serving this year. I thought I would sort it out by myself, and I would also publish an English version for practicing English. If there is a grammatical error, please include more.


One cause :

Forgot the login password of the WordPress website, how to reset the login password ?


Two solutions :

2.1 MySQL / MariaDB command to reset the password

STEP 1 In the Linux command line, convert the new password to an MD5 ( hash) string :

echo "my_password" | tr -d 'rn' | md5sum

Here my_password is the new password. Please replace it with your own new password. Aftermd5sumcalculation, a hash string like this will be generated:

a865a7e0ddbf35fa6f6a232e0893bea4  -

This line of output text has two fields. The first field is the password hash string we want, and the second field is the file name ( because the data is read from standard input here, the file name will be represented by - ) . Please copy the password hash string in the first column here, as you will use it later.


STEP 2 Use therootadministrator account ( or an account with permission to write to the WordPress database ) to log in to the MySQL / MariaDB database :

mysql -u root -p


STEP 3 List all the databases and find the database used to store WordPress website data :

show databases:

After finding the database used by your WordPress website, select it ( here my database name is blog)

show use tables;


STEP 4 List your own data sheet :

show tables;

Find the data table that stores the user account. Its name will end with users ( here, my data table is wp_users ). Then output the fields of ID, user_login, and user_pass to see :

SELECT ID, user_login, user_pass from wp_users;
| ID | user_login | user_pass                          |
|  1 | gtwang     | $P$qBpIvOiMyT1pm9vIPAs24tuyHs4KW91 |

These are all the accounts and passwords currently on the WordPress website. Please confirm the account ID to reset the password. In this example, I want to reset the account gtwang, and its ID is 1. STEP 5 Set the password field of this account to the MD5 hash string generated earlier :

UPDATE wp_users SET user_pass="a865a7e0ddbf35fa6f6a232e0893bea4" WHERE ID = 1;

This completes the reset of the password, and then you can open the WordPress web page and log in with the new password.


2.2 Reset password with phpMyAdmin

If your web space has a MySQL management interface that provides phpMyAdmin, you can also modify the password of a WordPress user from phpMyAdmin. The modification principle is similar to the command method.


After logging in to your own phpMyAdmin management interface, select the database where the WordPress website is stored, and find the data table of the user account ( the data table whose name ends with users).

After finding the user data table, search for the account whose password you want to reset, and then click “Edit”.


Modify the user_pass field for storing passwords, select “MD5” in the “Function” section, and then fill in the new password set by yourself in the value section.


Click “Execute”.

This completes the reset of the password.

2.3 Use FTP to reset password


Use FTP connection software ( such as FileZilla ) to connect to the web space of the WordPress website, grab the functions.php of the current theme, and add a line to this PHP file :

wp_set_password('my_password', 1);

wp_set_password The first parameter of wp_set_password is the new password, and the second parameter is the user ID.

After editing, put the file back to the original place and overwrite the old file.


Log in to the WordPress website with the new password.


Restore functions.php and remove the wp_set_password just added.


2.4 Use WP-CLI to reset the password

WP-CLI is a command interface WordPress management tool, we can use WP-CLI to reset the user’s password.

STEP 1 List all user accounts in WordPress sites:

wp user list
| ID | user_login | display_name | user_email             | user_registered     | roles         |
| 1  | gtwang     | G. T. Wang   | [email protected] | 2015-03-05 18:21:38 | administrator |

STEP 2 Reset user password:

wp user update 1 --user_pass="my_password"

This is a command to change the password of the user with ID 1 to my_password.



1. This image file is collected and reproduced from the Internet, and does not assume any technical and copyright issues.

2. If there is a download link for broadband testing and research purposes only, please delete it within 24 hours after downloading, and do not use it for commercial use.

3. If you have violated your legal rights, please write to us and we will delete it in time. We apologize for the inconvenience caused to you.

1 thought on “(WordPress)- How to reset the login password of WordPress website”


發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *