One of the most convenient methods to create a presence in the virtual world is through WordPress website development. Technically sound as well as amateur individuals can easily create and manage a website with WordPress. The open-source CMS is a choice of a wide range of users because of its user-friendly character and advantageous features. It has in-built facilities for most issues faced by people including one for changing passwords through email. Most people face problems in conducting the modification though if there is an issue with their email or hosting account. In this blog, we will discuss the various methods to change WordPress admin password when a person is unable to do so through the normal recovery mechanism.
Let’s first learn about the easiest method to reset the password when you remember the original one. Log on to the admin dashboard through the username and password. Locate the “Users” option in the menu on the left-hand side of the screen. A list containing all the admin users will be displayed. Select the one for which the password needs to be modified. See the below image for reference.
Once you click on the “Edit” tab, the Edit User screen will be displayed. In the bottom half of the screen, the fields for entering the new password are located. Enter the term of your choice followed by re-entering to confirm the choice. Once the “Apply” tab is clicked, the new term will be set as the password.
We will now present the methods for changing the password when a user has lost the original one. The easiest way to do it is through the lost password link present on the admin login page.
It can be seen below the fields for entering the username and passcode. Clicking on the link will take you to a new page. You will be required to provide the username or the email address that is associated with the WordPress account. Enter it in the specified field and click on the “Get New Password” tab. A mail will be sent to the email ID with a link for resetting the code. Use the link to create a new password and confirm the change.
WordPress development professionals use the WP CLI, a command line interface for completing various tasks associated with their job. They take its help to update themes or plugins and creating database backups besides many other functions. The WP CLI can also be used to change WordPress admin password by a user. Access the cPanel of your hosting service and locate SSH shell access in the “Security” section. Mac and Linux users can take help of their hosting service email ID to access the WordPress directory. Windows users have to rely on an SSH client like PuTTY for the same purpose. Once the directory has been accessed, type:
$ wp user list
This will display the complete list of users. Find the one from the list that you want to modify and use this line to make the change.
wp user update USERNAME –user_pass=”PASSWORD”
Remember that the USERNAME and PASSWORD in the above line must be replaced with terms of your choice.
Many users face a problem of not being able to make the modification through email. In such a scenario, the phpMyAdmin interface can come to their rescue. Log on to the cPanel of your website hosting account and locate phpMyAdmin in the database section. Click on the icon and you will see an option called “Databases” in the upper half of the screen. Once this tab is clicked, the WordPress website database will become visible in the left-hand side of the screen. Opening the database will lead to a page with a list of all the tables present inside it. Find the “wp_users” table in it and click on the “Browse” option present in front of it.
You will now see rows of all WordPress users. Select the “Edit” option for the user whose password is going to be modified.
Locate the “user_pass” field in the page visible now. Enter the new password and remember to select the MD5 option in the drop-down menu of the function field. This will encrypt the new term. Click on the “Go” option to save the changes.
All WordPress passwords are stored in a MySQL database and they can be changed from the database itself. Let’s see how the database can be accessed for making the desired modification. The hosting service account and SSH will be used in this method also. In the command line, enter the following command:
mysql -u USERNAME -p
Take care to replace USERNAME with your username. Enter your password when asked to do so and the mysql> prompt will be displayed. Now use the following command at the prompt to see the databases:
Insert the name of your WordPress database in place of databasename in the following command:
Now run this final command to complete the process:
UPDATE wp_users SET user_pass = MD5(‘Enter-new-password-here’) WHERE ID=1 LIMIT 1;
Consider a scenario where you are unable to access the cPanel or the database. This last method to change the password will come handy in such a case. Use FTP to login to your website and download the functions.php file of the active theme. In the image given below, the location of the functions.php file of Twenty Eleven theme is shown. This file will be modified to reset the password.
Open the file in and add the following line in the second line of the code after the opening tag i.e <?php:
wp_set_password( ‘newpassword’, 1 );
Insert your chosen term in the place of newpassword. Then upload the file back in its original location. Try logging on to the website now and if successful go back and download the functions.php file again. Remove the above line from the code to stop the program from resetting the password on every page load. Upload the file again to its original location to conclude the process.
These are some helpful methods to change WordPress admin password but there may be situations where even these tricks would not work. In such cases, people must eventually get in touch with expert WordPress development agencies to resolve the issue.