How to Reset Your WordPress Password?

Working with WordPress, there are some essential commands you need to master to ensure you can easily handle your day-to-day activities. After all, even if you are a complete beginner, you have to be acquainted with the basics.

Today’s guide will teach you more about the importance of your WordPress passwords and how to quickly reset them through various methods. 

When Do You Need to Reset Your WordPress Password?

There are numerous reasons why you might want to change or reset your WP passkey in the process of working with the app.  For example, you can be an outside author who was given auto-generated credentials, and you might want to switch them to something more memorable. As WordPress is a CMS that lures in a lot of hackers, it’s not uncommon to have to switch your password to avoid an emerging vulnerability or suspected breach. 

But the biggest reason in favor of frequently changing your WordPress login credentials is even more simple and obvious – better overall security. Even if your passwords are complex enough, it’s a good idea to switch them around from time to time. This way, you can prevent them from falling into some black market list of stolen credentials and causing tons of headaches in the long run.

With that in mind, here are some of the most common ways to reset a WP password.

How to Reset Your WordPress Password via the Automatic Emailer

This one is as easy as they come. Pretty much any online user has forgotten a password at least once, and the process of retrieving it is quite similar on many websites. 

  1. Go to your WordPress admin page (default is yourdomain.com/wp-admin)
  2. Click on the blue link Forgot Your Password.
  3. Now, input either your WP username or WP email address to verify your identity.
  4. You can go ahead and log into your email account.
  5. Follow the link and type in your new password. Then retype to confirm.

How to Reset Your WordPress Password via the MySQL Command Line

You can also access WP’s database through the command-line interface and reset your password from there. Bear in mind, however, that this requires root MySQL access, which isn’t available on all plans.

  1. Create a new text file that contains the new password. You can do that by typing:

# vi newpassword.txt

  1. We now need to create an MD5 hash string for the new password. To do so, use the command:

# tr -d ‘\r\n’ < wp.txt | md5sum | tr -d ‘-‘

Save the newly-generated string to your local computer. Additionally, you can delete the text file for extra security. The command is:

# rm -rf newpassword.txt

  1. Now, login to your MySQL as root:

# mysql -u root -p

  1. Find the correct MySQL database:

> show databases;
> use wordpress;

  1. The next step is to open it to view its content:

> SELECT ID, user_login, user_pass FROM wp_users;

  1. You should now be able to see the MD5 string of the current password. We need to replace it with the one we generated earlier. You can do so with the following command:

> UPDATE wp_users SET user_pass=(‘newMD5string’) WHERE user_login = ‘admin’;

  1. If you want to test if the new password has been successfully updated by typing:

> SELECT ID, user_login, user_pass FROM wp_users;

How to Reset Your WordPress Password via phpMyAdmin

  1. Log in to your control panel.
  2. Find the phpMyAdmin option under the Databases section.
  3. Find your WordPress database and select the wp_users table on the left. Click Edit.
  4. Input your new password in the user_pass field and select MD5 from the drop-down.
  5. When you click Go, the system should return a message that you have successfully updated your database record. 

How to Reset Your WordPress Password via FTP

  1. Log in to the FTP client of your choice.
  2. Navigate to the functions.php file and download it locally.
  3. You can now execute the following command:

wp_set_password(‘newpassword’,’admin’);

  1. Next, we need to upload the functions.php file back to our /themes folder (or the specific folder you downloaded it from).
  2. Go ahead and log into your WordPress dashboard. Once in, make sure to remove the wp_set_password line you added in step 3, or it will keep resetting after every page load.

How to Reset Your WordPress Password via WP CLI

WP CLI basically works like a WordPress terminal that allows you to execute commands. As such, it is predominantly preferred by developers and experienced users. To use WP CLI for your password reset, simply:

  1. Log in and open the /wordpress directory. 
  2. Once inside, type:

$ wp user list

This will show you a list of all registered users for your WordPress installation. 

  1. Find the ID of the user you are trying to modify and run the following command:

$ wp user update userID –user_pass=newpassword

You simply need to replace userID with the correct user and newpassword with the passkey of your choice. 

How to Reset Your WordPress Password Using the Emergency Password Reset Script

If all else fails, you can always try utilizing a PHP script that serves this exact purpose – the Emergency Password Reset Script. To do that, you would need to know the admin username and have access to the administrative email address

  1. Place the script in your root WordPress folder (not the Plugins directory). 
  2. Copy the entire Emergency Password Reset Script from the official WordPress repository. 
  3. Create a new file in your root WP folder and name it emergency.php. Paste the script inside. 
  4. Open the script in your browser by typing:

http://yourdomain.com/emergency.php

  1. Enter the admin username (the default is admin unless you’ve changed it) along with the new password you’ve chosen. Hit Update Options afterward.
  2. Test if everything works and delete the emergency.php file afterward. 

IMPORTANT: The last step is crucial as keeping the Emergency Password Reset Script on your server will leave it vulnerable for any savvy hacker to exploit and lock you out of your WordPress account. 

We hope this guide has helped you with resetting your WP password and learning more about the most popular CMS. If you have more questions – you can always contact the ScalaHosting Support for assistance. 

Was this helpful?

What’s your goal today?

1. Find the right Web hosting solution

If you’re looking for industry-leading speed, ease of use and reliability Try ScalaHosting with an unconditional money-back guarantee.

2. Make your website lighting fast

We guarantee to make your WordPress site load in less than 2 seconds on a managed VPS with ScalaHosting or give your money back. Fill out the form, and we’ll be in touch.

Please enter a valid name
Please enter a valid website
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

3. Streamline your clients’ hosting experience

If you’re a web studio or development agency hosting more than 30 websites, schedule a call with Vlad, our co-founder and CTO, and see how we can deliver unmatched value to both your business and your clients.

Photo

Need a custom cluster or professional advice?

Book a meeting and get a free 30-minute consultation with Vlad, co-founder & CTO of Scala Hosting, who will help you select, design and build the right solution - from a single data center cluster to a multi-region & multi-datacenter high availability cluster with hundreds of servers.

Book a free consultation

4. Learn how to grow your website in 2023

An all-star team of SEO and web influencers are sharing their secret knowledge for the first time in years. Learn about the future of SEO, Web Design best practices and the secrets to getting the foundation for your website to thrive. Watch the exclusive webinar.

An Exclusive Insiders Look Behind The SEO and Web Development Curtain

Rado
Author

Working in the web hosting industry for over 13 years, Rado has inevitably got some insight into the industry. A digital marketer by education, Rado is always putting himself in the client's shoes, trying to see what's best for THEM first. A man of the fine detail, you can often find him spending 10+ minutes wondering over a missing comma or slightly skewed design.