Manual reset of the WordPress admin password (wp-admin)
In this article, we will present the necessary steps to reset the password for the WordPress admin area directly from the database.
Introduction
- WordPress offers the ability to reset the password for the admin area using the Lost my Password button in the WP Admin login interface.
- However, there is a possibility that this option may not work for various reasons, such as:
- we no longer have access to and/or do not remember the email address set when WordPress was installed.
- we do not receive the reset instructions in the email.
- the "Lost your password" link does not work. - In these situations, the password can be reset directly from the WordPress database.
- In this tutorial, we will present the procedure using the cPanel control panel.
Requirements
- The login details for the cPanel are present in the email with the administration data.
Steps
- First, we need to identify the database associated with the WordPress site. We can do this using File Manager.
- We will access the cPanel panel, and in the Files section, we will click on File Manager.
- We will click on the root folder of WordPress. If it is the main domain of the hosting, this folder will generally be public_html. If it is an Addon domain, the folder can be identified by accessing cPanel -> Addon Domains.
- In this folder, we will right-click on the wp-config.php file, and then click on View.
- In the file just opened, we will look for the line of code in the form define('DB_NAME', . On this line, we can identify the database name. In our example, it is define('DB_NAME', 'demohost_wp602');. However, each application has a distinct database name.
- Once we have identified the database name, we can close the File Manager and return to the main panel of cPanel.
- We will go to the Databases section, then click on phpMyAdmin.
- Once the phpMyAdmin interface has loaded, we will click on the database with the name obtained in the previous step. In our example demohost_wp602.
- Next, we will click on the table named users. In our example, the full name of the table is wp4a_users. The table might have a different prefix, but it will contain "users".
- User data will be loaded into the WordPress application. Here, there may be several rows with multiple users having different access privileges. Generally, the oldest added user is also the one with complete administrative privileges. This can be deduced by using the user_registered column.
- We will click on the Edit button to the left of the admin user or the user for whom we want to reset the password.
- On the next page we can proceed to change the password. We are interested in the user_pass field. In this field, we will replace the existing string of characters with the new password, then to its left, in the drop-down menu, we will select MD5.
- To save the changes in the database, we will click on the Go button at the bottom of the page.
- If everything went smoothly, the password has been reset and we can try to log in to the WordPress administration.