❤️ AZDIGI has officially updated to a new blog system. However, some posts may have incorrect or mismatched images. Please click the Report article button at the bottom of the post so AZDIGI can update as quickly as possible. Thank you!
If you accidentally forgot your WordPress admin password, there are many ways for you to reset your WordPress user password, such as from email, phpMyadmin… And today, AZDIGI will show you how to use WP-CLI to reset your password, WP-CLI has been integrated into all hosting servers at AZDIGI.
To do this, you can follow the steps below.
Step 1: Access Terminal

Step 2: cd into the directory and list the users
I want to change the user password of the website linuxcanban.com. I will access the directory containing the source code linuxcanban.com with the cd command
Note:
- With the Primary Domain the directory containing the source code will be public_html
- With addon domain: the directory containing the source code will be in the directory named domain (if the original is unchanged)

Next, you list the users with the wp user list command
wp user list

Note:
- wp user list: to display all users on the website
- user_login: these are the users of the website
- ID: list of IDs corresponding to user
Step 3: Reset password
After determining the user to reset and the corresponding ID, enter the following command to proceed with the reset.
wp user update 1 --user_pass=$++xpGN^$GoT
Command annotation:
- wp user update: the command to update user
- 1: This number is the ID number that you listed in Step 2
- –user_pass=: option
- $++xpGN^$GoT: This is the password I need to change (please enter your password)

If you receive a Success message, the password reset is complete.
Wishing you success!
About the author
Thạch Phạm
Đồng sáng lập và Giám đốc điều hành của AZDIGI. Có hơn 15 năm kinh nghiệm trong phổ biến kiến thức liên quan đến WordPress tại thachpham.com, phát triển website và phát triển hệ thống.