Introduction to WordPress Password Resetting
When working in a local development environment with WordPress, it's common to encounter the need to reset admin password. This can be due to multiple reasons, such as forgetfulness or configuration changes. Fortunately, there are several methods to regain access to your administration panel without complications.
Method 1: Restore via phpMyAdmin
One of the most effective methods for resetting the administrator password in WordPress is by using the phpMyAdmin. This is a database manager that facilitates the manipulation of the information stored in your WordPress installation.
Access to phpMyAdmin
To get started, you need to access phpMyAdmin. Generally, you can do this from your local server's control panel, such as XAMPP or WAMP. Once inside, follow these steps:
- Select the database corresponding to your WordPress installation.
- Find the table named wp_users (may vary if you have changed the prefix).
- Click on "Browse" to see the list of registered users.
Password Modification
Once you locate the administrator user's row, you can modify the password as follows:
- Click on "Edit" next to the user you wish to modify.
- In the password field, select the option MD5 in the drop-down list.
- Enter the new password in the corresponding field.
Finally, save the changes and you will be able to access your WordPress dashboard with the new password.
Method 2: Resetting via functions.php file
Another option is to use the functions. 
Modification of the functions.php file
To carry out this method, follow these steps:
- Open the directory of your WordPress installation.
- Navigate to wp-content/themes/your-topic/.
- Locate and edit the file functions.php.
Then add the following code to the end of the file:
wp_set_password('new_password', 1);
Be sure to replace new_password with the password of your choice and 1 is the ID of the administrator user. Save the file and log in to your website. This will reset the password. Don't forget to delete this code after you have used it to avoid security problems.
Method 3: Using WP-CLI
If you have WP-CLI installed in your development environment, you can reset the password quickly and efficiently via the terminal.
Password Reset Command
To reset the password, open the terminal and navigate to the directory of your WordPress installation. Then, run the following command:
wp user update 1 --user_pass=new_password
Remember to change new_password for the one you want to use. This method is very convenient, especially if you are familiar with the use of command lines.
Password Management Tips
Once you have reset your password, it is important to maintain good password management to avoid future problems.
Recommended Practices
Consider following these practices:
- Use strong passwords that include uppercase letters, lowercase letters, numbers and symbols.
- Store your passwords in a password manager.
- Change your passwords regularly and do not use the same password for multiple accounts.
By following these guidelines, you will not only improve the security of your WordPress installation, but also reduce the likelihood of forgetting your passwords in the future.
