How to change password in WordPress

How to change password in WordPress - CodeFlist

After reading this article, you will learn how to change password in WordPress.

Need to change WordPress Admin Password

If you want to run your website, without any hassle then you need to be sure that your password is secure. There may be various reasons due to which there is a need to change your password. Some of them are:

  • Shared Access

There are situations when you share your password with someone else. However, you should never share your password with anyone else. Instead of sharing the password, you can create a new user with an appropriate role. Doing this will not only safeguard your site but it also allows you to delete users when you no longer need them. In such cases, you need to change the password as soon as the work is finished.

  • Password Crack

If someone has cracked your password, then you need to change it ASAP.

  • Forget Password

This should not happen but it occurs to most of the users. You need to keep safe your password by writing it in several locations.

  • Weak Password

Keeping a weak password invites hackers to your site.

If you are stuck in one of these situations, then you need to learn how to change password in WordPress.

How to reset the WordPress Admin Password?

How to reset password in WordPress
How to reset password in WordPress

There are multiple ways to reset your password. Depending on the method, you need to follow the steps to complete it successfully.

Change WordPress password from Dashboard

If you can log in to the admin dashboard, you can easily change the password. This method is effective only if your current WordPress session hasn’t expired yet. It is the quickest and easiest method that can be used for this process. When you do not have access to the email account, this method is recommendable.

At first, check the profile of the user that includes name, email and profile picture. You can change the password your profile from Users > Your Profile. If you are an admin, then you can also check all users from Users > All Users. You can edit the profile and choose to generate a new password under Account Management.

After you generate the new password, you can also choose to logout from everywhere else that secures your site. At the time of generating a password, WordPress will automatically suggest a strong password for you. However, you can keep your own password. But, WordPress will ask the confirmation message from you in case it thinks that it is a weak password.

To make your password secure, you should choose a strong password before you update the profile. This process is completed without signing out from the admin dashboard. When you have made the necessary changes then do not forget to Update Profile for the changes to take effect.

If you do not see the Profile Updated message, make sure that the new password is working or not. This can be done by trying to log in after signing out. If you cannot log in to the dashboard due to any errors, then you can reset the password with email. Let’s discuss it.

How to change password in WordPress from the login screen

There are two fields in the login screen of the WordPress website. One of the fields is Username or Email Address and another field is Password. The login screen will be the same for all the users of your site. In the bottom, there is a field stating Lost your password?

If you have lost access to your dashboard, you can use this option. When you click it, WordPress will ask you to enter Username or Email Address that links with your account. When you enter it, click Get New Password. Afterward, you need to check the associated email to that account. WordPress will send you a notification that somebody requested for the changing password operation.

If you ever get this message unexpectedly, someone is trying to crack your site. In such a case, we recommend changing your password as well as email to safeguard your site.

But if it appears after your action, simply open the link that you see in the email. It allows you to change the old password to any other password. WordPress will recommend the auto-generated strong password. Either you can use it or keep your own password, but sure the strength of the password is strong. You can save these passwords in the password manager so in future the password will be safe.

You will get the display message “Your password has been reset” when you proceed with the Reset Password button. As soon as you decide the new password for you, it only takes a few minutes to get this confirmation message.

Change WordPress password from the database

This method is recommended if you are unable to access the above two methods. There are conditions when you do not have access to mail and are locked out from the dashboard. In such cases, you can reset the password from the database.

If you make any changes to your site, the information is stored in the database. In that database, you can also find the password for the user accounts of your site. Due to the encryption of the database in WordPress, the site is safe from unexpected changes by unauthorized persons.

The site can face damage if the editing of the database is done incorrectly. Thus, before performing any changes you should create a backup and learn to access your file.     

Depending on your hosting provider, you can access the database from the control panel. There is a section named the phpMyAdmin inside the database inside the control panel.

phpMyAdmin

phpMyAdmin is a simple interface that allows viewing your database. The list of databases appears inside the file. In addition, the tables that make the database is seen in the right. There are tables for your site’s elements like posts, comments, users, etc.

At first, you need to save the backup to prevent any unexpected changes. Open the Export tab to download the content of the database as a single SQL file. Proceed further with the Quick and Go button. Now you can safely download this backup file which will be helpful if you accidentally face the errors in the database.

Hover the structure tab to check the database. You should check the data in the database for the user profile. It may be listed under wp_users or any other similar name according to the hosting. Find the location which will show you the registered users for the site. It contains the data including username, password, and email. The password that you observe is in the encrypted form. When you edit and keep the value of the new password, choose the MD5 algorithm to encrypt the password.

In addition, you can use this method to change the password of all existing users of your site. But, this should be the last choice as the previous two methods are user-friendly.

FTP

You can use this method to change the password in WordPress if you do not have access to the database.

At first, you need to open the functions.php file of the theme via. FTP and download it. After <?php in the second line, add the following code:

wp_set_password(‘password’,’admin’);

Be sure to keep the username and password correctly.    

After you finish modifying this file, you must upload it to the themes folder on your server. When you log in to the dashboard, use this new password. Once this operation is completed, delete the wp_set_password code from the functions file. Also, upload it again. It instructs WordPress not to reset every single time.

WP CLI

This is a command-line tool.

wp user update USERNAME --user_pass="PASSWORD"

Firstly, enter this command in the WordPress directory. Secondly, update the selected user.

Emergency Password Reset Script

If none of the methods worked for you, then you can use this script. You must know the username before you continue in this method. With the help of this script, the password gets updated and a notification is sent to the admin email. Sometimes you do not receive the mail but anyhow the password is changed. The script should be kept at the root during this process. However, the script should be removed when the process is completed. If not, someone else could use it.

Wrapping Up

WordPress allows resetting the password if you know the registered email or if you have the access to the dashboard. Furthermore, you can edit the database, use WP CLI or FTP. If you have no options left, then there is an option of an emergency password reset script.

Hopefully, now you learned how to change password in WordPress.

Additional Readings