How to Reset Your WordPress Password Manually

Chưa được phân loại

Struggling with how to reset your WordPress password?

Everyone gets locked out of one account or another from time to time – and this can happen even on your own website. It’s usually simple enough to perform a reset using the built-in WordPress password reset tool that you can access from the login page.

However, things can get tricky if you’re unable to use this tool for some reason. Therefore, learning how to reset your WordPress password manually can come in handy.

Fortunately, there are several ways you can approach this situation. You can reset your password by tweaking your database, for example, or simply use a dedicated tool to get the job done faster. Either way, it is possible avoid ever getting locked out of your WordPress account again.

In this article, we’re going to talk about some of the situations in which you may need to reset your WordPress password manually. Then we’ll teach you three simple ways to do it. Let’s get to work!

Why you might need to reset your WordPress password manually

WordPress enables you to reset your password any time you want through your login screen. All you need to do is click the Lost your password? link underneath the default WordPress login form.

However, there are times when you may not be able to access this feature. For example, your website could be down at the moment, or you may have lost access to your admin email address. It could even be the case that someone breached your site’s security and changed your email information, so you have no way to re-enter your website.

Reset your WordPress password

WordPress enables you to reset your password, but it’s useful to know how to do it manually.

These situations aren’t all that common, but they can happen to anyone. If you end up in one of these scenarios, you’ll be glad to know that there are other ways to reset your WordPress password. Let’s talk about three of them now.

Three ways to reset your WordPress password manually

All three of these methods work even if you don’t have access to your WordPress dashboard. You’re free to pick whichever one you want; the choice is largely down to personal preference.

Note – the methods here do involve editing some sensitive areas of your site. So if possible, we highly recommend taking a backup of your site first just in case. If your host offers this feature, you should be able to do it from your hosting dashboard even if you’re locked out of WordPress.

While nothing bad should happen by following these methods, it’s always better to be safe.

1. Reset your password through phpMyAdmin (cPanel)

All the information that makes up your website is stored within the WordPress database. Each piece of data has its own place in the database, and the easiest way to access yours is through a tool like phpMyAdmin. Most hosts offer phpMyAdmin, especially if your host uses cPanel.

We’ll write this tutorial assuming your host uses cPanel. However, if your host uses a different hosting dashboard solution, you might need to access phpMyAdmin via a different method. We recommend consulting your host’s support documentation for help.

For now, open cPanel via your hosting account. Then, look for the phpMyAdmin option under the Databases section:

The phpMyAdmin tool.

Once you’re inside phpMyAdmin, look for your WordPress database. In most cases, you’ll be able to identify it thanks to the wp_ prefix, although some hosts don’t use that as a default. If there are multiple databases and you’re not sure which of them you’re looking for, click on them one by one. At some point, you’ll find a database that includes the following tables:

An example of the tables a WordPress database contains.

This list shows all the tables that store your WordPress data. Look for the one called wp_users – or a variation thereof – and click on the Browse button next to it:

Browsing the Users table.

Inside, you’ll find a list including all your site’s users. Locating your own account shouldn’t be hard – just look for your username or email. Once you’ve found it, click on the Edit button for your username:

Editing your user.

On the following page, look for the section that says user_pass. You should see a long string of characters and numbers to the right. That’s your password, although it’s encrypted so no one can copy it (in case someone hacks into your database):

An example of an encrypted password.

However, as the administrator, you can change that password right from this window. All you have to do is delete the aforementioned string and replace it with whatever password you want in plain text.

In addition to entering the new password, you’ll also want to select the MD5 option from the drop-down menu to the left, like this:

Setting an encrypting a new password.

What this does is force your database to encrypt your new password using a format that WordPress will recognize. Now, click on the Go button at the bottom of the page.

Return to the WordPress login screen and try out your new password – it should work without a hitch!

Related: You can also create a brand new admin user via phpMyAdmin if needed.

2. Reset your password using FTP and the functions.php file

If you don’t feel comfortable digging into your WordPress site’s database, you can also reset your password using FTP and your site’s functions.php file.

To begin, connect to your WordPress site’s server via FTP. If you’re not sure how to do that, check out our FTP tutorial.

Once you’re connected to your server, find the functions.php file for your theme:

  1. Go to the root folder that contains all of your site’s files and folders.
  2. Navigate to the wp-content folder.
  3. Go to the themes folder (wp-content/themes).
  4. Select the folder for your active theme. For example, if you’re using the Neve theme, it will be wp-content/themes/neve.
  5. Locate the functions.php file in the theme folder.

First, download a copy of this file to your local computer so that you have a backup of the original file (just in case!).

Then, edit the functions.php file. Most FTP programs will let you edit a file by right-clicking on it:

Edit functions.php file

Add the following line of code immediately after the opening <?php tag:

wp_set_password('password',1);

Add line of code to functions.php file

Save the changes to the file and reupload it to your server.

Now, go to your login page and try to log in using these credentials:

  1. Username – your actual username or email address.
  2. Password – password

Yes – just enter the word ‘password’ as the password.

When you try to log in, the login page should just refresh and show an empty form (but you shouldn’t see a notice about an incorrect password). That’s normal. In fact, that’s what you want to see! You’ve just reset your account’s password to be password.

Before you can actually log in, though, you need to go back to the functions.php file and remove the line of code that you added. Once you’ve removed the code, save the file and reupload it to your server.

Now, you can go back to the login page and you should be able to actually log in for real using those credentials:

  1. Username – your actual username or email address.
  2. Password – password

Once you’re logged in, make sure to change your password to something more secure.

Note – this method will only work if you’re trying to log in to the administrator account that you created when setting up WordPress. If you’re trying to log into a different account, you’ll need to change the user ID, which is the number ‘1’ that appears in the code snippet. If you’re not sure how to do this, you might be better off using the previous method.

3. Use the WordPress Command Line (WP-CLI) to reset your password

For this third method, you need to be on a hosting plan that enables you to use WP-CLI out of the box, such as SiteGround or WP Engine – that way, you can hit the ground running.

The first thing you’ll need to do is enable Secure Shell (SSH) access using your web host’s control panel. For example, here are instructions on how to do it using SiteGround:

Using cPanel to set up SSH access to your server.

In short, the process involves generating ‘keys’ that identify you when you access your server via SSH from your computer. Once you’ve got your RSA private key, you can use either your command line (if you’re macOS or Linux user) or an SSH client such as Putty (if you’re on Windows):

Using Putty to connect to a remote server.

Once you’ve successfully connected to your server via SSH, you should be able to start using WP-CLI right away, since your host has already set things up for you. WP-CLI enables you to manage every single aspect of your WordPress website using simple commands, which is perfect for developers.

You can find a thorough list online of the commands you can use with WP-CLI, but for now, let’s focus on how to use it to reset your password. To complete that task, you’ll need to paste this line into your SSH client:

wp user update USERNAME --user_pass="PASSWORD"

Naturally, for the command to work, you’ll need to replace the USERNAME and PASSWORD values with your own new credentials. Unlike the previous method, WP-CLI handles data encryption, so there’s no need to configure any additional settings. Once you’ve entered the command, you can go ahead and log back into your WordPress account.

On the other hand, if you’re using a host that doesn’t include WP-CLI set up by default for your account, don’t worry – you can install it on your own if you have full access to your server. Just follow the instructions on WP-CLI’s home page within the Installing section, and you should be good to go.

Conclusion

Knowing how to reset your WordPress password manually can save you if you ever get locked out of your website, and you don’t have access to your email account. This isn’t something that happens often, but it doesn’t hurt to be prepared just in case. Plus, the process is simpler than you’d imagine.

Here are three alternative ways to reset your passwords manually:

  1. Use your cPanel to access and edit your WordPress database.
  2. Connect via FTP and edit the functions.php file of your theme.
  3. Use one of WP-CLI’s built-in commands to reset your password.

Do you have any questions about how to reset your WordPress password manually? Ask away in the comments section below!

Free guide

5 Essential Tips to Speed Up
Your WordPress Site

Reduce your loading time by even 50-80%
just by following simple tips.

Bài viết liên quan

Trả lời

Email của bạn sẽ không được hiển thị công khai.