• Skip to primary navigation
  • Skip to main content

RocketGeek

Home of WP-Members, The Original WordPress Membership Plugin

  • WordPress Plugins
    • WP-Members
      • FAQs
      • Quick Start
      • Documentation
      • Extensions
    • Advanced Options
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Download Protect
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Invite Codes
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • MailChimp Integration
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • PayPal Subscriptions
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Salesforce Web-to-Lead
    • Security
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Text Editor
      • Purchase the Plugin
      • Get the Pro Bundle
    • User List
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • User Tracking
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Memberships for WooCommerce
    • WordPass
  • Blog
    • Basics
    • Tips and Tricks
    • Filters
    • Actions
    • Code Snippets
    • Shortcodes
    • Design
    • Release Announcements
  • Store
    • Cart
    • Checkout
  • Contact
  • Log In
  • Show Search
Hide Search
Home » Basics » How to reset your WordPress password with WP-CLI

How to reset your WordPress password with WP-CLI

Chad Butler · Sep 25, 2018 ·

This article is provided free. Find out how you can get full access to premium content, including how-to articles and support forums, as well as priority email support and member exclusive plugin extensions..

 

It happens to all of us at some point or another – especially when doing development work – you find yourself locked out of your WordPress site with no way to change or reset your admin password.  What do you do in that situation?

Here is a way you can update your password (and other aspects of your account) directly from the command line. 

Note that this article assumes that you already have a “SSH” or “shell” account from your hosting provider and that WP-CLI (the WP Command Line Interface) is already installed, either by you or by your host.  Quite a few hosts are installing WP-CLI by default now, so you probably already have access to this powerful WP management tool without needing to install it yourself.

Log into your shell account and, if your login doesn’t take you to the specific WP site root, change the directory to the root of the site you are working with.

Before we change the password, I want to show you that if you forget commands in WP-CLI, you can get a list of them easily.  For changing the password, we’ll be using the “user” command, so enter “wp user” at the command line to get a list of possible actions you can complete:

This shows you all of the possible user commands.  The last one – “update” – is what we need to change the password, and it shows you that you need to enter the following:

wp user update the_username --user_pass=your_new_password

Our test user account we want to change is “1atest” and we’ll be setting the password to “mynewpass” (just by way of example).  Enter the following at the command line:

Upon successful update, you’ll get a success message (which will display the user ID that was updated):

That’s it!  You’ve updated your user password via the command line and can now log into the site.

Basics basics, wp-cli

Ready to get started?

Join Today!

© 2025 · butlerblog.com · RocketGeek is built using WordPress, WP-Members, and the Genesis Framework

  • butlerblog.com
  • WP-Members Support Subscription
  • Terms of Service
  • Privacy Policy
  • Refund Policy