HowTo: Recover WordPress Password Part I



A few days ago, I installed WordPress on one of my project/experiment blogs and I forgot to write down or change the temporary password. I only realized my mistake right after I signed out. I couldn’t remember the password and I couldn’t log back in. If it can happen to me, someone who has been using WordPress for several years now, I know it can happen to anyone, especially newbies.

There are times when we inadvertently lose or forget our blog passwords and when this happens, there are several ways to recover your WordPress password.

Automatic Remailer

If you can still remember your username and email address, you can use the WordPress automatic remailer or “lost password” feature found on your blog’s the login page.

  • Go to your WordPress Login page (http://yoursite.com/wp-login.php)
  • Click on Lost you password?
  • You will be redirected to a different page where you will be asked to enter your user name or email address.
  • Check your email inbox for your new password.
  • Login to your WordPress blog with your new password.
  • Go to Profile in your Admin panel and change the password to something that you can remember.

The problem with this feature is that it doesn’t work all the time, especially if the internal PHP mail function is disabled by your web host. I’ve had several experiences where I used that option and I never received the email.

If that happens, the next thing you can do is reset your password through the MySQL command line. You can do this by connecting directly to your server via SSH, or by using the MySQL client on your workstation to connect to your server. This is a bit complicated but you’ll be able to do it as long as you follow instructions. This process resets your password.

Through a MySQL command line
(replace all details in bold with your own data)

1. Type “mysql -u root -p” (Logs in to MySQL)
2. Enter your password at the prompt.
3. Type “use name-of-database;” (Select your WordPress database)
4. Type “show tables LIKE ‘%users’;” (Finds the WordPress user table)
5. Type “SELECT ID, user_login, user_pass FROM name-of-table WHERE user_login = ‘username‘;” (Observe the encrypted password)
6. Type “UPDATE name-of-table SET user_pass=MD5(‘new-password‘) WHERE user_login = ‘username‘;” (Updates the database with the encrypted password)
7. Type “SELECT ID, user_login, user_pass FROM name-of-table WHERE user_login = ‘username‘;” (To confirm password was changed)
8. Type “exit” (Exits the MySQL client)
9. Login to WordPress and using your username and new password.

If you don’t have this type of access or if this is too difficult for you, you can ask your web host to do it for you and once you have your new password, login and change the password to something you know and can remember.

Next part of this series will feature how to restore or recover your WordPress password using phpMyAdmin which is also a bit complicated but easier.

Check out HowTo: Recover WordPress Password Part II

Owner and editor of JaypeeOnline. Self-proclaimed geek. New media writer and consultant. WordPress advocate. Loves blogging, gadgets, video games and sports. You can follow him on Google+, Facebook or Twitter.

7 Comments

  1. Naresh

    November 28, 2010 at 7:57 PM

    Hi Jaypee! Many people around the world uses wordpress for there blog, For one or other day they may face this kind of problem, I guess this information really helpful for them…Thanks for sharing

  2. jon

    November 23, 2009 at 2:09 AM

    yeah in fact i have my own way around!
    first of all if you have simplescripts installed
    on your host, you have to determine the database number
    for the domain you require to access.
    should look something like this:
    Hostname: localhost
    Username: aaaaaaa_wp06
    Database Name: aaaaaaa_wp06
    Table Prefix: wp_

    second, after you have identified the database number you should go to cpanel to phpmyadmin.
    Once inside in phpmyadmin you will see on the left column the databases installed on your host you have to select the one you already
    identified.
    Click on it !
    aaaaaaa_wp06
    then on the column called tables select the icon search (it is a tiny magnifier on it)
    then you will see in the next page “Select fields (at least one)”
    select : user_email and click on the GO button
    and it will appear next page: user_email , there is a small pencil to edit the name of your email where you can retrieve your password.

  3. cmstips dude

    November 12, 2009 at 8:22 PM

    Hello- Yes, it worked! And yes, I was able to change my lost password, BUT one complaint- punctuation.

    take step #3, for example: Type “use name-of-database” (Select your WordPress database)

    where is the FREAKIN SEMICOLON? ;;;;;;;;;; ahhhhh!

    I know, I know. Duh. But really… If you’re sharing code, please give commands their own line with proper punctuation. For us small minded people who only remember a few things about all these damn languaages. It may seem like minutiae, but computers discern these things better than us humans do.

    And I’ll be able to keep all my hair before I remember to close my command lines.

    peace

  4. JP Habaradas

    March 3, 2008 at 7:32 AM

    @SB – Thanks for pointing that out! In case you haven’t read the second post, I’d like to let you know that this is a two part series and Part II is more user friendly in terms of instruction as it has some screenshots.

    I know what you mean and I appreciate you taking the time to share your feedback. If you think the other post is still to advanced for newbies, please let me know how I can improve it so I can make another post that will be more user-friendly. Thanks again and have a nice day! :)

  5. S B

    March 2, 2008 at 8:45 PM

    Well all I would say is that your popst is helpful only to the nerds. I am newbie and what you wrote looks very cryptic to me. Although, I learned how to recover my password from another site, yet I thought that I let you know.

    A lot many visitors needing help may stumble upon this page and I wish they don’t waste their time :)

  6. JP Habaradas

    July 28, 2007 at 9:23 PM

    @George – You can only do that for a fresh install and not if you want to keep all your data and just recover the password.

    You’re welcome! Thanks for dropping by. :)

  7. George Gardner

    July 27, 2007 at 10:00 PM

    Of course, you could also clear the database (or delete and re-create) just before deleting the wp-config.php file. (assuming it’s a fresh install and you have no important data in your database)

    Still, very cool. Thanks for this.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.