Sometimes, a WordPress user, with one of the following capabilities, such as administrator, editor, author, contributor, or subscriber, forgets its login credentials, especially the password.

WordPress passwords can be easily changed via the “Lost Password” WordPress login form. However, if the WordPress account has no way of accessing his email address, changing the password using this mechanism can be impossible. In such cases, the job of updating a WordPress account password can only be managed by a system administrator with full privileges to the MySQL database 

Prerequisite

A system running Ubuntu 18.04/20.04  should have the following

  1. A user account with sudo privileges
  2. Mysql DB credentials

Implementation

Step 1: SSH the server

$ ssh user@ip

Step 2: Login to the MySQL database with the user name and password   

$ mysql -u username -p dbname

Step 3: View the stored databases

$ show databases;

Step 4: Change the database as wptest

$ use wptest;

Step 5: Show the tables in the database – wptest

$ show tables;

Step 6: The password for WordPress is saved in the table wp_users. Explain the fields in wp_users 

$ explain wp_users;

Step 7: The user list is saved in user_login to find the user list follow the command mentioned

$ select user_login from wp_users;

Step 8: We need to update the password for the user – admin. To update the password follow the below command

$ update wp_uesrs set user_pass=MD5(‘new password’) where user_login=’admin’;

Step 9: Now the password is updated we can log in to WordPress with the updated password.

Leave a Reply