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
- 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
- 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
- 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!