How to reset a user password in WordPress

  Databases

In WordPress, there is more than one way to reset your password.
The one that we are going to explain here today is by setting a new password directly in MySQL Worpress database.

First access your wordpress website files and find a file config.php.inc.
Inside this file you will find the username the password the database name and the host where your database is stored. We will need this later to connect the database server.

The passwords of wordpress users are stored in the database, but not in clear text. Instead of clear text the what is stored inside the database is the hash. in MD5.

At this point you have two option :
You can create/generate the hash of the password yourself.
Or give everything to MySQl and let him do the rest.

If you choose the first option

On Unix/Linux:

Create a file called wp.txt, containing nothing but the new password.
tr -d ‘\r\n’ < wp.txt | md5sum | tr -d ‘ -‘
rm wp.txt

On Mac OS X:
Create a file called wp.txt, containing nothing but the new password. Then enter either of the lines below
md5 -q ./wp.txt; rm ./wp.txt (If you want the MD5 hash printed out.)
md5 -q ./wp.txt | pbcopy; rm ./wp.txt (If you want the MD5 hash copied to the clipboard.)

After you get all this and all the data regarding your database, we are going to access the MySQL command line.

mysql -u username(Extrated from config.inc.php) -p password -H host(Extrated from config.inc.php)
enter your mysql password

At this point we are in MySQL shell.
Now lets type:

use name-of-database ; 

Select WordPress database.

show tables; 
SELECT ID, user_login, user_pass FROM (name-of-table-you-found);
UPDATE (name-of-table-you-found) SET user_pass= 'MD5-string-you-made' WHERE ID = (id#-of-account-you-are-reseting-password-for);

Confirm that it was changed.

SELECT ID, user_login, user_pass FROM (name-of-table-you-found);

Type Control-D to exit mysql client.

Note: if you have a recent version of MySQL (version 5.x?) you can have MySQL compute the MD5 hash for you.

UPDATE (name-of-table-you-found) SET user_pass = MD5(‘(new-password)’) WHERE ID = (id#-of-account-you-are-reseting-password-for);

Note that even if the passwords are salted, meaning they look like $P$BLDJMdyBwegaCLE0GeDiGtC/mqXLzB0, you can still replace the password with an MD5 hash.