Home Website TutorialsWordPress How to Reset WordPress Admin Password using WP-CLI

How to Reset WordPress Admin Password using WP-CLI

by Thạch Phạm

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:

  1. wp user list: to display all users on the website
  2. user_login: these are the users of the website
  3. 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!

Đánh giá

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign