Introduction
This is article for changing the password of a user in a wordpress website. Basically, there is another password set for that user. But in this context, the password is going for reset because something or another reason. The higher chances are because there is already password for that user. But unfortunately, the user is forgetting the password and it is important to change or to reset the password.
Solution
The following are steps for resetting or changing the password for user available in a website based on wordpress platform. The following are those steps :
1. Access the database. In this context,the MySQL database server. It is because website using a wordpress-based platform is using MySQL database server as its database :
root@localhost ~# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 47 Server version: 5.7.27-0ubuntu0.18.04.1 (Ubuntu) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
2. Select the appropriate database representing the database of the website. Just execute the following syntax in the MySQL command console :
mysql> use db_wordpress; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A show tables; Database changed mysql>
3. Select the appropriate database representing the database of the website. Just execute the following syntax in the MySQL command console :
mysql> show tables; +-------------------------+ | Tables_in_db_wordpress | +-------------------------+ |... | | wp_users | |... | +-------------------------+ 14 rows in set (0.00 sec) mysql>
4. The table containing the information of the password of a user is exist in a table with the name of ‘wp_users’. Normally, that is the name if there is no change in the prefix name of the table. If there is a change on the prefix of the table, the name of the table will be ‘xxxx_users’. The ‘xxxx’ will vary according the value of the prefix of the table. Execute the following command or query to check the list of the user available in the table.
mysql> 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 | admin | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | admin | [email protected] | | 2019-09-28 14:11:50 | | 0 | admin | | 2 | editor | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | editor | [email protected] | | 2019-10-02 03:06:17 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | 0 | editor | +----+------------+------------------------------------+---------------+-------------------------+----------+---------------------+-----------------------------------------------+-------------+---------------+ 2 rows in set (0.00 sec) mysql>
5. As soon as the user for the reset or the change of the password exist and it is available. Just execute the following query in the MySQL command console as follows :
mysql> update wp_users set user_pass=md5('xxxxxxxxxxxxxxxxxxxx') where id=1; Query OK, 1 row affected (0.07 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql>
Finally, according to the output above, the command is a success. Just try to login again to the dashboard of the wordpress for logging in.