- On February 9, 2021
In this guide, we will introduce you to several ways in which you can change your WordPress password all by yourself.
Resetting Your Password Through WordPress
If you forgot your WordPress password, you can easily reset it from your site’s login page. Simply go to sitename.com/wp-login.php and click the Lost Password link below the login form.
In the new window, enter your account’s username or email address. Then, click Get New Password.
You’ll automatically be redirected to the login page and the password reset email will be sent to your address.
Simply click the link in the email to reset your WordPress password:
If you’re locked out of your account, that concludes the password reset process.
If you are not locked out of WordPress and simply need to reset your password, you can do that from your user profile in the CMS itself.
When you log into WordPress, click on Users from the menu on the left.
Select your account and click on Profile. You should now see the Set New Password button on the screen.
Enter a new password and click the Update Profile button at the bottom.
With this, the WP password reset process is complete.
Resetting Your WP Password with phpMyAdmin
If you are locked out of WordPress because of a forgotten password, you will have to reset it through your website’s backend. phpMyAdmin is a MySQL database manager and editor that provides you access to your website’s databases. In order to use it to change your WP password, first you need to be logged in. There are several ways to access phpMyAdmin, depending on the control panel you are using to manage your website. Below, we will look at the following three options.
- Hestia CP
How to Reset Your Password with phpMyAdmin Through Hestia CP
Open Hestia CP and select the Files tab.
Open the web folder from the list, as shown below.
In the wp-config.php file, look for the entries DB_USER and DB_PASSWORD. Those are your credentials for phpMyAdmin.
Return to the Records tab in Hestia CP and select the phpMyAdmin tab.
Log in to phpMyAdmin using the credentials found in wp-config.php.
Once you log into phpMyAdmin, check the list of databases on the right. Expand the admin-wp database and locate the wp_users table.
After you open the admin_wp_10030 folder, open the wp_users subfolder.
Selecting wp_users will open the registry of all WP users. In the example above, you can see that there is only one user — admin. Locate your account and click Edit. You should see a screen just like the one below.
Locate the user_pass column and change its function to MD5 from the dropdown menu. After that, type in a new password in the Value field. Make sure you remember it since this will be your new WP password.
Once you are set, click the Go button at the bottom of the screen.
Now that you have reset your password, you can use it to log into WordPress. We strongly recommend that you change the password once again from within WP, since the MD5 function you selected in phpMyAdmin is not the safest one for passwords.
How to Reset Your Password with phpMyAdmin Through cPanel
Resetting your password through cPanel works similarly to the previous method. As we already mentioned, cPanel automatically logs you into phpMyAdmin, so you do not need to look up credentials in wp-admin.php.
Simply log into cPanel and locate the phpMyAdmin tab as seen below.
From there, follow the exact same steps outlined in the previous method. Do not forget to change your password once again from within WordPress to ensure optimal security for your website.
How to Reset Your Password with phpMyAdmin Through WP-CLI
Another way to reset your WP password is by using WP-CLI — the command-line tool that WP comes with. It might seem a bit intimidating at first, especially for casual users, but it has great functionality and is relatively easy to use.
- If you do not have WP-CLI installed, you can log on using SSH (Secure Shell) and the following commands.ssh root@your-abelohost-IP (for example, 18.104.22.168)root@your-abelohost-IPs password: <your root password>
- If you already have it installed, simply open the prompt. Once you are in, execute the following command line.curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x wp-cli.phar && mv wp-cli.phar /usr/local/bin/wp
- You will now have access to your website’s databases, similarly to being logged into the control panel. Next, you have to locate the document root directory which contains the entries for user passwords. Depending on the control panel you are using, the paths can be a bit different.
- cPanel: /home/your_cpanel_username/public_html
- Hestia CP: /home/admin/web/your_domain_name/public_html
- aaPanel: /www/wwwroot/your_domain_name
- If you are not sure whether the path is correct, there is an easy way to check that. Simply enter Is before the pathname, like in the example below.ls /home/admin/web/domainname.com/public_html
- If the path you have entered is correct, you should be looking at a list of the .php files of your website — wp-config.php, index.php, wp-content.php, etc. You can now enter the following command to change your WP password instantly.wp –allow-root user update <your WordPress username> –user_pass=”<your new password here>” –path=<path to document root>
- If you get a Success message, your WP password is now changed to the new one you entered.
- Go to WP and once again reset your password from within the CMS as we have shown above.
Changing Your WP Password with MySQL in Terminal
If you do not have phpMyAdmin installed on your website, there are still ways to reset your password via MySQL and MariaDB’s internal command line.
- Once again, you can use SSH to log into the server with the following command lines.
ssh root@your-abelohost-IP (for example, 22.214.171.124)
root@your-abelohost-IPs password: <your root password>
- The next step is to create what is called an MD5 hash of the password you want to use for our WP account. In order to do that, execute the following command in the prompt.
$ echo “my_new_password” | md5sum
- Once this is done, you need to gain access to the MySQL databases for your website.
$ mysql -u database_user -p database_name
Enter password: <database password here>
- With this, you can now access and edit the wp_users table which contains the entries for all passwords. Execute the next two commands to change your WP password with the new one that you saved as an MD5 hash.
> SELECT * FROM wp_users;
> UPDATE wp_users SET user_pass = “hash of your new password” WHERE ID = 1;
- You will now be able to log into WP with your new password. Once you are inside, we highly recommend changing the password once more from within WP.
Tips for Creating a Secure Password
Modern hackers have many effective tools they can use to hack your password with ease. In order to keep your website safe, you should take the time to create a secure password that will be tough to crack. Here are some general tips that should help you set up a proper password for your WP account.
- Your password should be longer than 16 characters
- Make sure you use a mix of alphanumeric characters and symbols, as well as upper-case and lower-case letters
- Do not use sequential keyboard paths like QWERTY or 12345
- Avoid common substitutions (for example P@$$w0rd instead of password).