Have you forgotten your WordPress admin password and can’t login to your WordPress dashboard?
Worry no more, because in this article, I am going to share with you all the ways known to us that will allow you to reset your WordPress password.
There are a lot of reasons why you might want to reset your WordPress password. Maybe you forgot your password or someone hacked your site and changed your password.
Whatever the reason, one of the methods below is surely going to help you reset your password.
Select what you want to do:
How To Change WordPress Admin Password?
If you already know your WordPress admin password and just want to change it, follow below steps:
Login to your WordPress dashboard and Navigate to Settings > Your Profile:
Now, scroll down to the Account Management section and click the Generate Password button:
Now, either use the generated random password or change it to something else and click the Update Profile button:
This is the easiest way to change your WordPress password.
As you can see, it will only work if you are logged in to your WordPress dashboard.
Now, in the next section, I will show you how you can reset your forgotten WordPress password through email.
How to Reset Forgotten WordPress Admin Password?
There are 4 methods you can use to reset your forgotten WordPress password. Let's try the first method.
Method 1:
Reset WordPress Password Through Email
This is one of the easiest ways of resetting your WordPress password.
Here’s how you can do it:
Visit the login page of your WordPress website which can be located at
your-site.com/wp-admin
and click the Lost your password? Link:
Now, enter the email or username you use to login and click the Get New Password button:
Now, you will receive an email with a password reset link:
Click the password reset link at the bottom of the email. It will take you to the password reset page. Now, enter a new password and click the Reset Password button:
You can now use your new password to login to your WordPress Dashboard.
If you are facing any problems resetting your password with this method, the following methods will surely help you.
How to Find The Name of Your WordPress Database?
Before we move on to the next techniques, it is really important for you to know the name of your WordPress database.
If you already know the name of your WordPress database, you can skip to the next section.
The techniques that follow will require you to know the name of your WordPress database. So, here’s an easy way to find the name of your WordPress database:
If you have FTP access to your server or if you can access your WordPress installation from your control panel, find the wp-config.php file and open it.
Now, look for the following line of code:
define('DB_NAME', ‘YOUR_DB_NAME_HERE');
In most cases you will be able to find this line of code at the near top of the file:
If you are having trouble finding this line of code, press CTRL + F and search for DB_NAME.
In the above line of code, YOUR_DB_NAME_HERE will be the name of the database.
For example, if the name of your database is wordpress_db, the line of code will look like this:
define(‘DB_NAME’, ‘wordpress_db’);
Now that you know the name of your WordPress database, we can move on to the next section.
Method 2:
Reset WordPress Password Using PHPMyAdmin
If you have phpMyAdmin installed on your server and have access to it, then you can easily change your WordPress admin password by following the below steps:
If you are on a PHPMyAdmin installed VPS server, you can locate it at your-site.com/phpmyadmin.
If you are a cPanel user, open PHPMyAdmin by logging into your cPanel and selecting PHPMyAdmin:
Once you are logged into PHPMyAdmin, select your WordPress database from the list of all the databases in the left:
Now, select the wp_users table:
Now, type your username or email in the Search box:
Now click the edit button on your result to edit it:
Now, Select the MD5 option from the Function drop down and enter a new password in the value field:
Now, click the Go button at the bottom of the page to save this new password:
If you followed the above steps correctly, you have now successfully reset your WordPress password and can use the new password to login.
Method 3:
Reset WordPress Password Using MySQL
If you have access to your MySQL console, you can reset your WordPress password by using the SQL queries listed below in this section.
To reset your Password using the below SQL query, connect to your VPS using your SSH client, enter the below command and press the enter key:
mysql -u username -p
In the above command, replace username with your real MySQL username:
Now, enter the password for the MySQL user and hit enter:
Now, enter the following command after replacing DATABASE_NAME with the name of your WordPress database:
USE DATABASE_NAME;
Now, enter the below SQL query and hit enter to change your WordPress password:
UPDATE wp_users SET user_pass = MD5('NEW_PASSWORD’) WHERE user_login = 'USERNAME';
In the above SQL query, replace NEW_PASSWORD with the new password you want and USERNAME with the username you use to login:
Executing the above SQL query will change your WordPress a password to whatever you replace NEW_PASSWORD with.
If you still haven’t been able to reset your WordPress password, the next section will surely help you.
Method 4:
Reset WordPress Password Using functions.php File
This method requires access to the directory where you have installed WordPress.
If you are using cPanel or any other control panel, you can use the File Manager or connect with FTP.
If you are on a VPS, you can connect to your server via SFTP to follow along.
Depending on the method you use to connect to your server, the design of the interface you use will change.
In the following example, I am using FileZilla FTP client to connect to my server.
Don’t worry if your FTP client doesn’t look the way mine does. You only have to find the functions.php file and edit it.
To reset your password using this method, follow the below steps:
Login to your control panel or your FTP client.
Now, navigate to wp-content directory:
In the wp-content directory, look for the themes folder and open it:
Now, look for the folder with name of the current theme you are using and open it:
In my case, I am using Twenty Sixteen WordPress theme.
Now, look for the functions.php file and edit it:
Add the following code right after the “<?php” line:
$user = get_user_by( ‘login’, ‘USERNAME’);
wp_set_password(‘PASSWORD’, $user->ID);
wp_set_password(‘PASSWORD’, $user->ID);
In the above code, replace USERNAME with your username and PASSWORD with the new password you want to use:
Now, visit the homepage or any other page of your website.
Once you visit your website, remove the code you added to the functions.php file.
You can now use the new password you set to login to your WordPress website.
Conclusion
All the methods in this article are really easy to follow. I am sure one of these must have helped you reset your WordPress password.
If you are still facing problems resetting your WordPress Password, try hiring a WordPress Expert.
There are more ways than the ones listed above, but the ones other than these take a lot of time and require a lot of technical knowledge.
If you haven’t been able to reset your password using any of the above methods, It would be better for you to hire a WordPress expert than tweaking WordPress code yourself.
Have any questions or feedback?
Let me know in the comments section below
0 comments:
Post a Comment