Server Guru

Just another Tech Blog


Reset WordPress user password from MySQL command line


You can reset the password of a WordPress user by executing the following steps.

Step 1 : Login to MySQL console from SSH.



You can get these details from the “wp-config.php” file of your WordPress Site.


Step 2 :  Access the corresponding database.


mysql> use WP_DATABASE ;
Database changed


Step 3 : Get the user ID from the table “wp_users”. Please replace “WP_USERNAME” with the correct username.


mysql> select ID from wp_users where user_login = ‘WP_USERNAME’ ;
| ID |
| 1 |
1 row in set (0.00 sec)


Step 4 :  As you can see “1” is the IP of the username. Now you can update the password using the following query.


mysql> UPDATE `wp_users` SET `user_pass` = MD5(‘PASSWORD’) WHERE `wp_users`.`ID` = 1;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0


Step 5 : All done, now you can access the WP Dashboard using the new credentials.

Leave a Reply