WordPress password can be easily changed via “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 MySQL database daemon. In this guide we will show you how to reset a WordPress account password via MySQL command line in Linux. Before logging in to MySQL/MariaDB database service, first create a MD5 Hash version of the new password that will be assigned to the account, by issuing the below command.
After you’ve generated the new password MD5 hash, log in to MySQL database with root privileges and issue the below command in order to identify and select the WordPress database. In this case the WordPress database is named “wordpress”.
Next, execute the below command to identify the table responsible for storing WordPress user accounts. Usually the table that stores all user information is wp_users. Query wp_users table to retrieve all users
ID
, login name and password and identify the username ID field of the account that needs the password changed.The username ID value will be used to further update the password.
After you’ve correctly identified the ID of the user that needs the password changed, issue the below command to update his password. Replace the user
ID
and password MD5
Hash accordingly. In this case the user ID is 1 and the new password hash is: e6053eb8d35e02ae40beeeacef203c1a. In case you don’t have an already MD5 hashed password, you can execute MySQL UPDATE command with the password written in plain text, as shown in the below example. In this case we’ll use MySQL MD5() function to calculate the MD5 hash of the password string.
After the password has been updated, query wp_users table with the ID of the user that you’ve changed the password in order to retrieve this user database information.
That’s all! Now, inform the user that his password has been updated and it should be able to log in to WordPress with the new password.
No comments:
Post a Comment