WordPress – reset your admin password using Command line (quick way)

Sometimes, you lose your credential to your wordpress admin dashboard, i guess many of you had this question in mind : what is the quickest way to reset my admin password ?

error-wp1

In WordPress, there is more than one way to set your password. In normal circumstances, you can do it through the WordPress interface. If you forget your password, WordPress has a built in recovery mechanism that uses email.

But on some hosts, especially when email isn’t working right, sometimes you have to take different steps to reset your password. in this article, i’ll show you how to reset you admin password using command line:

1. log in to MySQL

mysql -u root -p

enter your mysql password, then select WordPress database

use (name-of-database)

look for a table name with “users” at the end :

show tables;

find your admin user:

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

reset user password:

UPDATE (name-of-table-you-found) SET user_pass=MD5('your-desired-passowrd') WHERE ID = (id#-of-account-you-are-reseting-password-for)

to see the result (not really necessary), execute this query:

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

(type Control-D, to exit mysql client)