How To Change WordPress Password In MySQL Using The SQL Code?

change wordpress password using mysql

You know that if you forget the password of your WordPress admin panel then you would be locked away from your admin panel. You won’t be able to handle your website. So it’s always recommended to note down the important usernames and the passwords of the accounts.

Do you know how to change WordPress password in MySQL? Though, there are others ways using which you can change the WordPress password. But still, it’s important to know an alternative. Instead of using the email option or the user edit option, I am going to guide you to change WordPress password using MySQL.

A Quick Guide To Reset WordPress Password MySQL.

There are some steps including the use of the cPanel of your web host. You can successfully reset the password using the SQL code. If you are aware of the Sequential Query Language then it would be great for you to understand. If you don’t have any idea about SQL then nothing to worry about. I will walk you through.

Step 1:- Login to your cPanel and go to the “databases” section. Click on the “phpMyAdmin” option.

how to change wordpress password in mysql

Step 2:- A new tab would open in your browser. Now you have to select the database of your website. Just click on the name of the database from the left side vertical menu.

Step 3:- All the tables would open from which you have to find “wp_users”. It is the table prefix by default. If you have changed the table prefix to run multiple websites with one database then you have to find that table prefix.

change password

If you haven’t done that then the table prefix would be “wp_users”. Click on that.

Step 4:- Now click on the “SQL” option from the horizontal menu shown above.

change wordpress password using mysql

Step 5:- In here, you have to add a query string to change the password for the user. It can be followed for any user.

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

As I have mentioned above that if you have changed the table prefix then replace “wp_users” with that. Otherwise, the code would work perfectly fine. Replace the “password” from the code with your password.

It’s always recommended to have the strong password so that no one break into your website. You won’t like to get your website hacked.

Step 5:- After adding the code shown above, just click on the “Go” button. Try to login to your WordPress admin panel. If you could able to login then you have successfully changed the password.

You can follow the same procedure for any user of your website. When you have multiple users on your website then it’s necessary to keep changing your password.

If anyone the users request you to change the password from the cPanel then you can do the same. There would be one change in the code. Just replace the ID or just write ‘user_login’= ‘username’. Before making any changes, it’s recommended to backup the database.

In WordPress, if you lost the username of the wp-admin panel then you can change the username using the phpMyAdmin.

Are You Ready To Change WordPress Password Using MySQL?

I have mentioned the method using the MySQL. You can change the WordPress admin password using directly by the “edit” option or directly by clicking on the “forgot password” option shown on the login screen. But sometimes, it doesn’t work because due to the security reasons, most of the web hosts have removed the mail() function.

So it would be great if you reset WordPress password MySQL. I am sure, it won’t be so hard as it seems. Just follow the steps mentioned above and put the SQL query on SQL editor and you would be able to login to your admin panel again.

If you found this article helpful, you can connect with us on Twitter, LinkedIn, and Facebook for regular updates.

by Ravi Chahar

A blogger, web developer, and designer who intends to guide his readers about WordPress, Blogging, Web Development, Web Design and more. I have expertise in WordPress theme development and customization. I can set up and redesign the Thesis themes. I have been working in this field for years now.

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge