We all forget passwords.
It’s easily done — if you’re sensible and have different passwords for different accounts, keeping track of what’s what can be tough.
Usually, resetting a forgotten password in WordPress is simple enough. You just click on the little “Lost your password?” link below the login box, and a password reset link will be sent to your site’s registered email address.
But what if, for whatever reason, you can’t get access to that email account? This was something that I experienced recently, and as you might imagine, I was rather keen to discover a resolution. Today, I want to share my findings with you.
ManageWP Users Need Not Fear
If you are a ManageWP user, as long as you can gain access to your account, you do not need to worry about losing passwords for your individual sites.
After all, you can access any of your sites registered to ManageWP directly from your dashboard, which means that you can change any password to something a little more memorable with just a few clicks. Furthermore, you can use our bulk user management feature, which allows you to add and remove users, change multiple passwords, and plenty more.
So, ManageWP users get a free pass when it comes to forgotten passwords. But what if you are not a ManageWP user at the moment?
Using phpMyAdmin to Change Your Password
As long as you can gain access to your hosting account, don’t sweat it. With just a few simple steps, you can change the existing password to a new one, which will allow you to log into your WordPress site as per usual.
1. Identifying Your WordPress Database
If you do not know the name of the database which relates to the site you are unable to gain access to, you will first need to identify it. If you do know the name of the database, you can skip this step.
You will need to access the root directory of your website — either via your hosting provider’s File Manager (located on the cPanel), or via an FTP client. Either way will work fine. The file you are looking for within your site’s root directory is “wp-config.php” — go ahead and open it up.
Within that file you will see a variable identified as “DB_NAME”, like this:
The value of that variable is the name of your site’s database. Make a note of it.
2. Locating Your Password in phpMyAdmin
Log into your hosting provider’s cPanel and locate phpMyAdmin:
Once logged into phpMyAdmin, click on the “Databases” tab, followed by the name of the database that relates to the site you are unable to gain access to. You will be presented with a list of tables like this:
Click on the “wp_users” table. You will now be presented with a list of users registered to your site:
Click to edit the user whose password you wish to change, and you will be presented with a list of variables relating to that user — the most important of which is “user_pass”.
3. Changing Your Password
If you look at the data contained within the “user_pass” variable, you will see that it is encrypted:
In order to replace this, you will need to generate your own encrypted password. Fortunately, doing so is a piece of cake — just head over to the MD5 Encryption website, enter your chosen password into the relevant box, and hit “Encrypt It!”:
Obviously, I recommend that you use a secure password, with random words or characters, numbers, symbols, and random capitalization.
The tool will spit out an encrypted password, which you can then copy and paste into the “user_pass” field in phpMyAdmin. Once you’re done, just hit “Go” at the bottom of the screen.
That’s it! If you head back to your WordPress site’s login screen, you will find that your new password will work!
Creative Commons image courtesy of Freddy The Boy