How to Reset Your WordPress Admin Password with MySQL
There are several methods that you can use to reset your WordPress admin password. You can use the built-in password reset tool, if you remember your username or email. You can also reset your password via PhpMyAdmin if you have access to your cPanel. However, in the rare case that the above two methods don’t work, as a last resort you can try and reset your password with MySQL.
When resetting the password using this method there are fewer steps involved. However, you will need some information beforehand. Also, you need to make sure you have access to the server your website is hosted on, via SSH.
- SSH client (Putty is a good one for windows)
- Name of the WordPress database
- MySQL server’s IP.
- Username and password of MySQL
- The ID of the user whose password you want to change.
For this example, we are going to use the following data:
– name of the WordPress database: wp_genesis
– ID of the admin user or the user you want to reset the password for: 1
– default WordPress user table: wp_users
– MySQL password: password
– SSH user: tnlafcom
Step 1: Log in to the server
Enter the hostname or IP address of the server along with the SSH port. Most of the time, shared hosting providers use the same server as MySQL server (localhost). By default, SSH login runs on port 22, but your hosting provider might have that changed. If you are unsure of the details, contact your hosting provider and ask for them. Once you have them, click on open.
Once you have connected to the server, it will ask for login credentials. Enter your username and press enter. After that, you will be prompted with the password entry. Write your password and press enter for access to the server.
If the login credentials are correct, then you will have SSH access to the server. You can now type the following commands in order to reset your WordPress admin password.
Step 2: Login to MySQL
To login to MySQL type the following line of command:
mysql -u root -p <password>
Once you have access to the MySQL CMD as shown above enter the following command
SELECT ID, user_login, user_pass FROM wp_users;
UPDATE wp_users SET user_pass = MD5(‘NewPassword’) WHERE ID=1 LIMIT 1;
That’s it! You should now have successfully reset the password for the admin user in your WordPress.
Now you can exit the terminal by using the exit command.
If you have any questions regarding on how you can reset your WordPress admin password, leave a comment down below. We will reply to your questions as soon as we can!