3 Ways to Change a Lost WordPress Password

Forgetting your password for your WordPress website can be a worrying time, but whilst it's inconvenient and frustrating, all is not lost. Today we're going to show you 3 different ways to change your password when you've forgotten it.

1. Use the WordPress password reset form.

The simplest way to reset a lost WordPress password is to use the built-in form provided by WordPress.

To do this, simply go to your WordPress login link and then click on Lost your password?

You'll then be taken to a screen which prompts you to enter your username, or your email address associated with your WordPress account in order to reset your password.

Once you've entered your username or email address, click on the Get New Password button and your WordPress website will email you a link to reset your password, which will then allow you to log in.

But we understand it's not always that easy - you may have forgotten what email address is linked to your account, or no longer have access to the email account, or perhaps your WordPress website just isn't sending out the password reset email - all is not lost!

2. Use phpMyAdmin to change your WordPress password or email address.

The second option we have today is to change the password via phpMyAdmin - alternatively, you may prefer to update your email address via phpMyAdmin and then follow option 1 above, if you don't have access to your email address any more. We'll show you how to change both your password, and email address for your WordPress website using phpMyAdmin.

Firstly, you need to access phpMyAdmin - how you do this will vary from host to host, but if you've got access to a hosting control panel such as cPanel, just search for phpMyAdmin and click on it.

In most cases, this will take you straight to the main phpMyAdmin front page, you should see a list of databases on the left hand side - select the one for your website (if you're unsure on which database you need to access, take a look at your wp-config.php file, this will show the database being used).

Go ahead and click on the [+] symbol beside your database, you will then see a list of database "tables" - WordPress websites can have many different table names and prefixes, you need to locate the tabled that ends with the word users, for example, wp_users - in our example image, the table is named wpbk_users. Go ahead and click on your user table.

You should now see a screen with a list of users (if you have multiple users, or just your own account if you're the only member) on your website, we'll only be modifying a single user, your account, so locate it in the list.

As you'll see, we have several columns:

  • ID: This is the user ID used by WordPress, and the database
  • user_login: This is the username you use to log in to your WordPress website
  • user_pass: This is the password for your user, in hashed format - it's not possible to decode it, but it is possible to change it.
  • user_nicename: This is a URL sanitized version of your username, if you don't have spaces or special characters in your username, it will be the same as user_login, otherwise it will replace characters to make the username url friendly, for the purposes of profile and author links.
  • user_email: This, as the name suggests, is the email address associated with your user account.
  • user_url: If you have set a website in your WordPress profile, this will be stored in the user_url
  • user_registered: This is the date and time that your user account registered on your website.
  • user_activation_key: If this user account was signed up via the WordPress signup form, and received an activation email to activate, the activation key will be shown here
  • user_status: currently, this isn't used, so may be removed, or repurposed in the future
  • display_name: this is how your user's name appears on your website, for example in the author section of a post you have written

For the purposes of this guide, we'll be looking specifically at 2 of the above - user_email and user_pass. If you'd like to change your email address to follow option 1 above, simply double click on the existing email address and it will open up an edit box for you

Once you've changed it, click anywhere outside of the edit box and it will save your new setting - you can now follow option 1 above if you wish.

However - we're now going to go ahead and change the password directly in phpMyAdmin.

As mentioned already, the password is hashed by WordPress so that it can't be read by a user or hacker, and for that reason, any new password we set will also need to be hashed. The simplest way to do this, is to md5 encrypt our new password before we paste it in, WordPress will then rehash it using it's hash keys.

To create a new md5 password, use a website such as https://www.md5hashgenerator.com/ on the website, enter a password you wish to use in the box provided, and then click on Generate - you will then be given a hash as well as your original string

Make sure you remember "Your String" and then copy "Your Hash" to your clipboard, then go back to phpMyAdmin and double click on the existing password hash in the user_pass field

Paste your new hash into the field, then click outside of the edit box to save - you should now see your new password hash saved.

Now go ahead and log in to your WordPress website with your new password, and update any credentials you need to.

3. The third and final option - Reset your WordPress password using WP-CLI

WordPress Command Line Interface (WP-CLI) is a very useful tool if you have access to SSH on your webhost, for the purposes of this guide, we're going to assume that you have SSH access and WP-CLI is already installed on the server.

The first thing we need to do is get our user ID, we can do this by running the user list command

# wp user list

This should show us a full list of users, as well as the user IDs, make a note of the ID for your user and we'll then change the password using the following command

# wp user update <user id> --user_pass=YourNewPass

Be sure to replace <user id> with your user id, and if you'd also like to change your email at the same time, you can do so - a full example of changing email address and password would be

# wp user update 1 --user_pass=YourNewPass [email protected]

Once done, press enter and you should receive a success message

Success: Updated user 1.

You should now be able to log in to your WordPress website using your new password.

A Web Design Company based in Farnham, Surrey.
Copyright 2019 Pyxal Creative. Registered in England and Wales 12201331