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.
[simterm]
mysql -u DB_USER_NAME -p’DB_USER_PASSWORD’
[/simterm]
You can get these details from the “wp-config.php” file of your WordPress Site.
Step 2 : Access the corresponding database.
[simterm]
mysql> use WP_DATABASE ;
Database changed
mysql>
[/simterm]
Step 3 : Get the user ID from the table “wp_users”. Please replace “WP_USERNAME” with the correct username.
[simterm]
mysql> select ID from wp_users where user_login = ‘WP_USERNAME’ ;
+—-+
| ID |
+—-+
| 1 |
+—-+
1 row in set (0.00 sec)
mysql>
[/simterm]
Step 4 : As you can see “1” is the IP of the username. Now you can update the password using the following query.
[simterm]
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
mysql>
[/simterm]
Step 5 : All done, now you can access the WP Dashboard using the new credentials.