Introduction:

In my last post, I outlined the XAMPP program and what it can do. Unfortunately, I hit a bit of a bump in the road, and wanted to share with others how I got around it.

Once I installed XAMPP, set up a new local database for testing, extracted a fresh copy of WordPress in the new c:/xampp/htdocs/wordpress folder I created, I opened wp-config-example.php to add my database and account info, and then saved it as wp-config.php.

All good so far, right? Well, not exactly. To begin the WordPress installation, I pointed my browser to http://localhost/wordpress/wp-admin/install.php
I entered my user name and email address and clicked on the next button.

At this point is where the snag came in: normally a randomly-generated initial blog password is displayed and/or sent to the email address you provided at initial setup for you to use when logging in for the first time. After you log in, you can change your password to whatever you like. However, when running your blog on your hard drive as localhost, you may not ever get that initial email, and worse yet, you can't access your blog's admin panel to change anything. If your email service is not set up, or if your firewall is blocking such communication, there is still a way to get in. Note that this applies to a locally-running XAMPP-powered test blog as well as a live, web host-powered blog.

The problem:

If you're the only administrator for a WordPress blog, and a user's provided email address becomes invalid for any reason, that person can't receive a new randomly-generated password to get back into the site. If your site is based on a WordPress version newer than 2.0, there is an easy way to manually set a new password for yourself or any other user. I know of no easy way to recover an existing password once it is lost.

The recovery process involves using the phpMyAdmin panel to directly edit your database. Note that any changes you make here are permanent, so having a good backup is always recommended. In this case, however, since I was using a test blog, and it was brand new (no substantial content added yet), it is relatively painless to create a new database if needed to recover from any mistakes.

The resolution:

That said, here are some instructions that I put together for getting this important job done easily. For this I was using Apache v2.2.11, PHP v5.2.8, and MySql v5.1.30:

  1. Log in to your phpMyAdmin panel on your local computer.
  2. Select the database you set up for your WordPress test site. I used wordpress-test for mine. You should see the dws_users table listed under it in the left-hand pane:

    Find the wp-users table

    Find the wp-users table

  3. Find the table called wp-users and select the Browsebutton:

    Browse the wp-users table

    Browse the wp-users table

  4. In the user_login column, find the row that contains the user name whose password you want to edit, and click on the pencil icon in that row:

    Edit user

    Edit user

  5. Once this is open, in the Function column, make sure you select MD5, and then find the column labeled user_pass and delete all the characters in this field. Type in your desired password and click on the Go button:

    Edit user password

    Edit user password

  6. That's it! Now you can log in to your WordPress test blog using your new password... 😉

I hope this will help someone else out.
-Dan

The End