In WordPress, there is more than one way to set your password. In normal circumstances, you can do it through the WordPress interface, email, php admin… In this article, i will show you how to reset your admin password through mysql command line.
1. Get an MD5 hash of your password. It’s because mysql store your password in hash type
Create a key with Python. or…
Create file wp.txt with the new password in it (and *nothing* else)
For ex: if your password is “123123”, go to http://www.miraclesalad.com/webtools/md5.php and type 123123 in the box. The website will give you the MD5 hashed password (“4297f44b13955235245b2497399d7a93”) after 1 second.
2. “mysql -u root -p” (log in to MySQL)
enter your mysql password (if you don’t remember you mysql root password, you can see the article “how to reset mysql root password” i’ve possed in this blog.
3. “use (name-of-database)” (select WordPress database)
For ex: mysql> use wordpress; (My wordpress database named “wordpress”)
4. “show tables;” (you’re looking for a table name with “users” at the end)
For ex: wp_users
5. “SELECT ID, user_login, user_pass FROM (name-of-table-you-found)” (this gives you an idea of what’s going on inside)
6. “UPDATE (name-of-table-you-found) SET user_pass="(MD5-string-you-made)" WHERE ID = (id#-of-account-you-are-reseting-password-for)” (actually changes the password).
For ex: “update wp_users set user_pass='4297f44b13955235245b2497399d7a93' where id=1;”
7. “SELECT ID, user_login, user_pass FROM (name-of-table-you-found)” (confirm that it was changed)
8. (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.
1. Skip step 1. above.
2. Do the following for step 7. instead.
“UPDATE (name-of-table-you-found) SET user_pass = MD5('"(new-password)"') WHERE ID = (id#-of-account-you-are-reseting-password-for)” (actually changes the password)