Prerequisites:
WordPress database name
MySQL server address (IP or hostname)
MySQL root access
The user ID of the WordPress user. This is typically 1 since, during WordPress installation, we create the admin user. Note that the username of the admin user can be anything, but the user ID will always be 1, since, this is the first user you’ve created.
Assumptions:
WordPress database name: wordpress
User ID: 1
New password: NEWP4SS
Execution:
mysql>use wordpress;
Database changed
mysql>SELECT ID, user_login, user_pass FROM wp_users;
+----+------------+------------------------------------+
| ID | user_login | user_pass |
+----+------------+------------------------------------+
| 1 | admin | $P$BBUy8tXvX/AdFmNBhBM5bxZhEpyn9M1 |
+----+------------+------------------------------------+
1 row in set (0.00 sec)
mysql>UPDATE wp_users SET user_pass = MD5('NEWP4SS') WHERE ID=1 LIMIT 1;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql>exit