WordPress Admin Password Reset with WP-CLI
What Will You Learn in This Guide?
In this guide, you will learn how to reset WordPress admin password via command line.
With WP-CLI, you will provide a fast and safe solution without entering the database.
🧠 Phase 1 – Analyze Content (Technical Summary)
Main Technical Topic: Resetting WordPress admin password with WP-CLI
Problem solved: Loss of wp-admin access
Steps Followed: User listing → Password update → Login test
Prerequisites
- Linux server with SSH access
- A working WordPress installation
- WP-CLI must be installed
- User with authority
sudo
Sample environment: GenixNode – Ubuntu 22.04 – Apache/Nginx
1️⃣ Switching to WordPress Directory
- First, enter the directory where WordPress is installed.
cd /var/www/html
- This command switches to the WordPress home directory. Your directory path may be different.
2️⃣ Listing WordPress Users
- Let's learn the user ID to reset the password.
wp user list
- This command lists all WordPress users.
Sample Output
ID user_login display_name user_email 1 genixnode_admin GenixNode Admin admin@ornek.com
-Make note of the ID information of the user whose password will be reset.
3️⃣ Updating Admin Password
- Use your own information in the command below.
wp user update 1 --user_pass=YeniGucluSifre
-
This command changes the password of the specified user ID.
-
If successful, you will see the following message: Success: Updated user 1.
4️⃣ Testing New Password
- Go to the administration panel from the browser:
https://alan-adiniz.com/wp-admin
If you can log in with the new password, the process is complete 🎉
❓ Frequently Asked Questions (FAQ)
1. What is WP-CLI, why is it used? WP-CLI allows you to manage WordPress without a browser. It is the fastest method to reset your password.
2. I get the error You cannot run this command as root If you are running the command as root, add the following parameter:
wp user list --allow-root
3. Can the password be changed without a user ID? Yes, username or email can also be used. However, using ID is safer.
4. Will this process damage the database? No. WP-CLI uses WordPress' own functions.
5. What should I do if WP-CLI is not installed? You can install wp-cli.phar by downloading it and moving it to /usr/local/bin/wp.
🚀 Result
Thanks to WP-CLI, you have reset WordPress admin password in seconds. No panel, email or phpMyAdmin required.
You can immediately try WP-CLI supported WordPress servers on the GenixNode platform.

