前言
因后台密码忘记了,需要重置
步骤
- 登录服务器。
- 进入数据库,输入
mysql -uroot -p
提示后输入密码。
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 429
Server version: 10.11.6-MariaDB-log Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
- 根据自己的数据库情况,使用
show databases;
查看所有库。确定数据库名为hezhengyue
,使用命令use hezhengyue;
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| hezhengyue |
+--------------------+
5 rows in set (0.001 sec)
MariaDB [(none)]> use hezhengyue;
- 先查看需要修改的账户id为1,输入下面命令,设置密码为123456。
MariaDB [hezhengyue]> select * from wp_users;
+----+------------+------------------------------------+---------------+-----------------------+------------------------+---------------------+---------------------+-------------+--------------+
| ID | user_login | user_pass | user_nicename | user_email | user_url | user_registered | user_activation_key | user_status | display_name |
+----+------------+------------------------------------+---------------+-----------------------+------------------------+---------------------+---------------------+-------------+--------------+
| 1 | 6666666666 | 6666666666666666666666666666666666 | 6666666666 | 666666666666666666666 | https://hezhengyue.com | 2022-12-15 08:45:33 | | 0 | 666666 |
+----+------------+------------------------------------+---------------+-----------------------+------------------------+---------------------+---------------------+-------------+--------------+
1 row in set (0.001 sec)
MariaDB [hezhengyue]> UPDATE wp_users SET user_pass = "$1$rSziHLDY$399k.JuJsy.oHVp5lquJC." WHERE ID = 1;
Query OK, 1 row affected (0.001 sec)
Rows matched: 1 Changed: 1 Warnings: 0
"$1$rSziHLDY$399k.JuJsy.oHVp5lquJC."
为123456的加密。
UPDATE wp_users SET user_pass = "$1$rSziHLDY$399k.JuJsy.oHVp5lquJC." WHERE ID = 1;
表示修改wp_users表中的ID为1,列名为user_pass的数据,也就是用户的密码。
- 登录WordPress后台-用户-设置新密码