Yesterday there was some issue with my servers MYSQL db so I was unable to login withmy admin password

I tried clicking the “forgot password” link however I was unable to do so. So after playing with MYSQL for around for 15 minutes, I reset my password. This is how.

You can also get Get an MD5 hash of your password by this

  • Visit MD5 Hasher , or…
  • Create a key with Python. or…
  • On Unix: echo -n <password> | md5sum

Through MySQL Command Line

  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)
  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)
  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)

Enjoy..

There is one more utility that can reset the password when everyone of the above steps fails.:)

Let me know if you want it.

Enjoy

~Himanshu~

Advertisements