How to reset WordPress admin password via SSH

We can reset WordPress admin passwords via command line in cPanel server for domains.

First, we need to find which Database is used by the domain for WordPress. You can find it via checking the Database name given in the file ‘wp-config.php’.

Upon finding that, login to MySQL prompt.

# mysql

mysql> use databasename;

where databasename is the database in which WordPress is installed.

mysql> SELECT ID,user_login,user_pass FROM wp_users;

| ID | user_login | user_pass |
| 1 | admin | $P$B05GJOhuMCFlxtYsYjA8P/sX0svNw81 |

mysql> UPDATE wp_users SET user_pass =”2886b319b37e797234026d279bafd745”;

mysql> SELECT ID=1,user_login,user_pass FROM wp_users;

| ID=1 | user_login | user_pass |
| 1 | admin | 2886b319b37e797234026d279bafd745 |

You can generate a MD5 encrypted password using any of the online tools available here a good one;