Resetting User Password in WordPress Through Database

| 0 comments

WordPress usually stores user information in wp_users table. But usually doesn’t mean always. To be able to reset admin password, we need to find out table name.

SELECT table_name FROM information_schema.columns WHERE column_name = 'user_login';

+---------------+
| table_name    |
+---------------+
| blog_wp_users |
+---------------+
1 row in set (0,05 sec)

In this case, user information is stored in blog_wp_users table.

To select user information from the table (id, login and password):

SELECT id, user_login, user_pass FROM blog_wp_users;

+----+-----------------+------------------------------------+
| id | user_login      | user_pass                          |
+----+-----------------+------------------------------------+
|  1 | admin           | Ap$byabtnlgblmm$u7dcv5sm20rufe6jj/ |
|  7 | kasaev          | Gp$b0r/i5/$wcusj6lofhs7u.tpg0iecaf |
|  9 | merkushin       | $p$bg/mc52ua/.2cujsy1nz2lhzy.89zmh |
+----+-----------------+------------------------------------+
3 rows in set (0,00 sec)

To set a new password for user kasaev (that’s me):

UPDATE blog_wp_users SET user_pass = MD5('kasaev_password') WHERE id = 2;

That’s it.

Leave a Reply

Required fields are marked *.