Reset the Password on a WordPress Account

Introduction

I happened to forget my admin password after some time of not using the account. I used ChatGPT to create the instructions to change the password. ChatGPT gave me a few options. Below is the option I picked to get my database to working order.

Instructions

Install WP-CLI

If you don't already have WP-CLI on your WordPress server, use the following instructions to do just that.

  • Download the wp-cli.phar file:
    sudo curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
  • Make the file executable with:
    sudo chmod +x wp-cli.phar
  • Move the file to a directory in your path with:
    sudo mv wp-cli.phar /usr/local/bin/wp
  • Verify that WP-CLI works with:
    wp --info
  • You should see an output similar to this: OS: Linux 6.6.74+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.74-1+rpt1 (2025-01-27) aarch64
    Shell: /bin/bash
    PHP binary: /usr/bin/php8.2
    PHP version: 8.2.26
    php.ini used: /etc/php/8.2/cli/php.ini
    MySQL binary: /usr/bin/mysq1
    MySQL version: mysql Ver 15.1 Distrib 10.11.6-MariaDB, for debian-linux-gnu (aarch64) using Edit
    Line wrapper
    SQL modes:
    WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
    WP-CLI vendor dir: phar://wp-cli.phar/vendor
    WP CLI phar path: /var/www/html
    WP-CLI packages dir:
    WP-CLI cache dir: /home/username/.wp-cli/cache
    WP-CLI global config:
    WP-CLI project config:
    WP-CLI version: 2.11.0

Change Password With WP-CLI

Follow these simple steps to change the password on your WordPress Server.

  • Switch to your WordPress directory with the following command:
    cd /path/to/your/wordpress
  • You can confirm that you are in the correct directory if you have the file named
    wp-config.php
  • Once installed, list the users with: wp user list
  • You should see a table with the configured usernames and roles.
  • Use the following command to change the password, where admin is the desired user name, which you can pick up from the output of the previous command:
    wp user update admin --user_pass=newpassword
  • You should see a message like the following:
    Success: Updated user 1
  • Use your browser to log in with the new password.