Fam Wencong, Kenneth

My Diary

Resetting Your WordPress Password

Published: Saturday, January 25, 2020

In WordPress, there is more than one way to reset your password.

Normally, the easiest way to reset it is through the “Lost your password?” link on the main login page for your blog or website.

However, there are certain times (especially if your email isn’t working correctly) that you may have to take different steps to reset your password.

Here are 2 ways to reset your WordPress password.

Through MySQL Workbench

In order to regain access to the administration pages, there’s only one SQL query required.

The command is shown below.

UPDATE wp_users SET user_pass = MD5('password') WHERE ID = 1;

Via FTP

There is also an easy way to reset your password via FTP, if you’re using the admin user.

Login to your site via FTP and download your active theme’s functions.php file.

Edit the file and add this code to it, right at the beginning.

wp_set_password( 'password', 1 );

Enter your own new password for the main admin user. The “1” is the user ID number in the wp_users table.

Upload the modified file back to your site.

Once you are able to login, make sure to go back and remove that code. It will reset your password on every page load until you do so.