WordPress: сбросить пароль администратора

Автор: | 03/06/2016
 

wordpressНаходим таблицу пользователей:

mysql> show tables;
...
| wp_users                      |
+-------------------------------+

Находим пользователей:

mysql> SELECT ID, user_login, user_pass FROM wp_users;
+----+---------------+------------------------------------+
| ID | user_login    | user_pass                          |
+----+---------------+------------------------------------+
|  1 | wpadmin       | $P$Bs3***fNA.                      |
...
| 17 | test          | $P$Bed***7w0                       | 
| 18 | testtest      | $P$Bjp***Xt/                       |
+----+---------------+------------------------------------+

Администратор как правило – пользователь №1:

mysql> SELECT * FROM wp_users where id = '1';
+----+-------------+------------------------------------+---------------+-----------------------+----------+---------------------+---------------------+-------------+---------------+------+---------+
| ID | user_login  | user_pass                          | user_nicename | user_email            | user_url | user_registered     | user_activation_key | user_status | display_name  | spam | deleted |
+----+-------------+------------------------------------+---------------+-----------------------+----------+---------------------+---------------------+-------------+---------------+------+---------+
|  1 | wpadmin     | $P$Bs3***fNA.                      |     wpadmin   | [email protected]    |          | 2011-09-02 08:34:40 |                     |           0 | Administrator |    0 |       0 |
+----+-------------+------------------------------------+---------------+-----------------------+----------+---------------------+---------------------+-------------+---------------+------+---------+

Для MySQL 5 и выше – достаточно выполнить запрос вида:

mysql> UPDATE wp_users SET user_pass = MD5 ('парольтут') WHERE ID = '1';
Query OK, 1 row affected (0.04 sec)
Rows matched: 1  Changed: 1  Warnings: 0

Проверяем:

mysql> SELECT * FROM wp_users where id = '1';
+----+-------------+----------------------------------+---------------+-----------------------+----------+---------------------+---------------------+-------------+---------------+------+---------+
| ID | user_login  | user_pass                        | user_nicename | user_email            | user_url | user_registered     | user_activation_key | user_status | display_name  | spam | deleted |
+----+-------------+----------------------------------+---------------+-----------------------+----------+---------------------+---------------------+-------------+---------------+------+---------+
|  1 | wpadmin     | 7f77***4e38                      | wpadmin       | [email protected]    |          | 2011-09-02 08:34:40 |                     |           0 | Administrator |    0 |       0 |
+----+-------------+----------------------------------+---------------+-----------------------+----------+---------------------+---------------------+-------------+---------------+------+---------+

Логинимся через wp-login.php, как обычно.

Аналогично – можно сменить почтовый ящик администратора – и воcпользоваться ссылкой “Забыл пароль” на странице логина.