Reset WordPress Password Using MySQL

The WordPress Password Recovery series is a helpful resource for those who have forgotten their WordPress login credentials. The tutorials are sorted according to popularity, with the most popular recovery option being the use of phpMyAdmin. However, some web hosting providers do not offer cPanel or phpMyAdmin, which is where this article comes in handy.

Rest assured, every hosting provider must have a Database Management System (DBMS), commonly MySQL. In this tutorial, we will be using the MySQL command prompt (CMD), which is a free DBMS licensed under GNU General Public License v2.

Before we begin, it is important to have a working understanding of databases and how WordPress interacts with them. Additionally, you will need to know the name of the database being used by the WordPress installation, the MySQL server address (IP or hostname), the MySQL login credentials of the ‘root’ user, and the user ID of the user whose associated password you want to change. This is typically 1 since the admin user is created during WordPress installation.

To log in to the MySQL Command Prompt on Windows, click on the WAMP icon > MySQL > MySQL console. This will log you in directly without needing to enter any more commands. On Linux, launch terminal emulator and type the command “mysql -u root -p”. If you are trying to reset the password on a remote server, connect to it via SSH using any SSH client and use the command “mysql -u root -p “.

Once you have access to the MySQL CMD indicated by the “mysql >” prompt, it’s time to reset the password. Assuming the WordPress database name is wp_genesis, the user ID is 1, and the new password is WPEXPLORER, enter the following commands:

use wp_genesis;

SELECT ID, user_login, user_pass FROM wp_users;

UPDATE wp_users SET user_pass = MD5(‘WPEXPLORER’) WHERE ID=1 LIMIT 1;

This will reset the password of the admin user to WPEXPLORER. It is important to use a strong password when setting a new one. Once done, exit the MySQL CMD by using the command “exit”.

For a visual guide, a video tutorial is available. While part (a) of the WordPress Password Recovery series is simpler because 90% of hosting companies come with phpMyAdmin, trying out part (b) using MySQL will give you some experience in handling MySQL commands and databases.

Prevention is better than cure, and password saving/backup services like LastPass can help. LastPass is one of the most complete and user-friendly password management software out there, and it is highly recommended to use it. Additionally, every time you log in to a new website, make sure to save the password.

Stay in Touch

spot_img

Related Articles