Tag Archive for UPDATE (wp_users) SET user_pass

Change wordpress admin password from mysql command line

If you forget the wordpress login password we can reset it in many ways. My favourite way is to change it from mysql command line. Follow the below steps to change it.

1. mysql -u root -p (login to mysql)
2. mysql> show databases;
3. use wp-database; (your wordpress database)
4. mysql> show tables;

You can see a table wp_users which contains all the user details. Use the below command to see the details of it.

5.  mysql> describe wp_users;
6. mysql> SELECT ID, user_login, user_pass FROM wp_users;

It will display all the details of the users.

+—-+————+————————————+
| ID | user_login | user_pass                          |
+—-+————+————————————+
|  1 | admin      | $P$BJvA.ZCJYfueDfJ1BRjcae6.3QHglB/ |
+—-+————+————————————+

7.mysql> UPDATE (wp_users) SET user_pass="specify the new pasword in MD5 format" WHERE ID = (specify the id of the user which we need to change the password);

use any MD5 creator site to make the password in md5 format. For example,

mysql> UPDATE (wp_users) SET user_pass=”21232f297a57a5a743894a0e4a801fc3″ WHERE ID = (1);

 

If you have the recent version of mysql, it can create the md5 password itself.

“UPDATE (wp_users) SET user_pass = MD5(‘”(new-password)”‘) WHERE ID = (1)”

Thats it. You have successfully changed the password.