Have you lost or forgotten your WordPress admin password? Are you unable to login to the WordPress Dashboard because your password no longer works? Did your WordPress website or user get hacked or compromised?
Resetting a WordPress website can be a daunting task, but with the right tools and knowledge, it can be a relatively simple process. In this tutorial, we will cover four different methods for resetting a WordPress website: the default “forgot password” method, using phpMyAdmin, using SSH and the command line interface (CLI), and using MySQL.
Method 1: Using the Default “Forgot Password” Method
- Go to the login page of your WordPress website.
- Click on the “Lost your password?” link.
- Enter the email address associated with your WordPress account and click on the “Get New Password” button.
- Check your email for a message from WordPress with a link to reset your password.
- Click on the link in the email to be taken to a page where you can reset your password.
- Enter your new password twice and click on the “Reset Password” button.
Method 2: Using phpMyAdmin
- Log in to your control panel/cPanel/Plesk account and navigate to the phpMyAdmin tool.
- Select your WordPress database from the list of databases on the left-hand side.
- Click on the “SQL” tab at the top of the page.
- Enter the following SQL query into the text box:
UPDATE wp_users SET user_pass = MD5( 'new_password' ) WHERE user_login = 'username';
- Replace “new_password” with your desired new password and “username” with the username of the account you want to reset the password for.
- Click on the “Go” button to execute the query.
- The password for the specified user will now be reset to the new password.
Method 3: Using SSH and CLI
- Log in to your server via SSH.
- Navigate to the root directory of your WordPress installation.
- Run the following command:
wp user update username --user_pass=new_password
- Replace “username” with the username of the account you want to reset the password for and “new_password” with your desired new password.
- The password for the specified user will now be reset to the new password.
Note: The password will be plaintext. It is important not to keep the password unencrypted, but to update the password within the WordPress Dashboard right away.
Method 4: Using MySQL
- Log in to your MySQL server via the command line.
mysql -u username -p - Select your WordPress database by running the following command:
use wordpress_db;
- Run the following SQL query:
UPDATE wp_users SET user_pass = MD5( 'new_password' ) WHERE user_login = 'username';
- Replace “new_password” with your desired new password and “username” with the username of the account you want to reset the password for.
- The password for the specified user will now be reset to the new password.
Note: In this tutorial, we use the default table prefix ‘wp_’ for the table name, if your prefix is different, please replace ‘wp_’ with your prefix.
In conclusion, resetting a WordPress website can be done in multiple ways, and it’s important to understand the different methods and which one is best for your specific needs. Using the default “forgot password” method is the easiest way for users to reset their passwords, but in case you don’t have access to the email or if you want to reset other users’ passwords, using phpMyAdmin, SSH, CLI and MySQL can be a good option.