Tuesday, April 20, 2010

retrieve or reset password of wordpress localhost installation using mysql

For localhost installation of wordpress the 'lost your password' option is not usefull.
here is the way to retrieve the lost password

in the terminal type the following
  1. "mysql -u root -p" (log in to MySQL)
  2. enter your mysql password
  3. "use (name-of-database)" (select WordPress database)
  4. "show tables;" (you're looking for a table name with "users" at the end)
  5. "SELECT ID, user_login, user_pass FROM (name-of-table-you-found)" (this gives you an idea of what's going on inside)
go to http://www.miraclesalad.com/webtools/md5.php

type your password and findout the md5 key.
copy that key
  1. "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)
  2. "SELECT ID, user_login, user_pass FROM (name-of-table-you-found)" (confirm that it was changed)
  3. (type Control-D, to exit mysql client)
go to wordpress login screen and login with your new password