WordPress 2.5.1: How to reset password manually

This bug has been fixed and will be included in WordPress 2.5.2. However, if you’ve upgraded to 2.5.1 and having issues with password reset,  you can do password reset, with any of following ways:

    1. Login to your PhpMyAdmin account, and select your WordPress database.
    2. Select & browse wp_users table, look for the username, you want to reset the password and click on the edit icon next to your username.
    3. Once the edit page is open, select MD5 from the Function dropdown next to the user_pass row. Change the value on the user_pass row to your new password and then hit Go.
    4. Now fireup your WordPress admin panel, and login with your new password and it will upgrade your password to the new phpass hashing.
  1. Or, if you’ve only single user on your WordPress installation, and the login name is admin. You can reset password with just simple SQL query, which once executed will replace password with whatever you enter as your new password to be. UPDATE `wordpress`.`wp_users` SET `user_pass` = MD5('PASSWORD') WHERE `wp_users`.`user_login` =`admin` LIMIT 1; WordPress, Brecker, Password, MySQL, Database, SQL Query, PHP, Tips, Tricks, Tips and Tricks, SQL, Passwords, Bug
  2. If you’re not comfortable with PhpMyAdmin or you don’t to do it manually, as an alternate, you can download files which contain the patch, here.
Published in: on October 11, 2010 at 12:21 pm  Comments Off on WordPress 2.5.1: How to reset password manually  

Wordpress Site migration


Changing The Site URL

// WordPress stores two addresses inside the database. These determine where your blog files are, and where the main index is. On a normal install, these addresses are the same.

There are two occasions where you will need to access the database to alter one or both of these settings:

  1. If you have tried to alter the Blog URL or WordPress URL in Settings, and an error has occurred.
  2. If you have moved to a domain/subdomain with a different name.

BACKUP your database before you begin and store the backup off your site server, like on your hard drive. See: Backing Up Your Database.

Edit wp-config.php

It should be possible to fix the site URL using a new feature –

Add these two lines to your wp-config.php, where “example.com” is the NEW location of your site.


This is not necessarily the best fix, it’s just hardcoding the values into the site itself. You won’t be able to edit them on the General settings page anymore when using this method.

Thanks filosofo for the fix, implemented in 2.2.

Edit functions.php

If you have access to the site via FTP, then this method will help you quickly get a site back up and running, if you changed those values incorrectly.

1. FTP to the site, and get a copy of the active theme’s functions.php file. You’re going to edit it in a simple text editor (like notepad) and upload it back to the site.

2. Add these two lines to the file, immediately after the initial “<?php” line.


Use your own URL instead of example.com, obviously.

3. Upload the file back to your site, in the same location. FileZilla offers a handy “edit file” function to do all of the above rapidly, if you can use that, do so.

4. Load the login or admin page a couple of times. The site should come back up.

5. Repeat the above steps, but remove those lines. IMPORTANT: Do NOT leave those lines in there. Remove them immediately after the site is up and running again.

If there is no functions.php file in the theme: Create a new text file called “functions.php”. Edit it with notepad, and add this text to it, using your own URL instead of example.com:


Upload that to your theme directory, then proceed as stated above. Remove the file afterwards.

Relocate method

WordPress supports an automatic relocation method that will figure out and update those values for you automatically. This method is intended to be a quick assist to getting a site working when relocating a site from one server to another.

To use it:

1. Edit the wp-config.php file.

2. After the “define” statements, add this new one:


3. Go to the wp-login.php page in a web browser.

4. Login as per normal.

When the RELOCATE flag is set to true, the siteurl (NOT the home setting) will be automatically updated to whatever path you are using to access the login screen. This will get the admin section up and running on the new URL, but it will not correct any other part of the setup. Those you will still need to alter manually.

You should remove the additional line after the site is up and running. Do NOT leave it enabled.

Changing the URL directly in the database

If you know how to access phpMyAdmin on your host, then you can edit these values directly to get you up and running again.

  1. Backup your database and save the copy off-site.
  2. Login to phpMyAdmin.
  3. Click the link to your Databases.
  4. A list of your databases will appear. Choose the one that is your WordPress database.
  5. All the tables in your database will appear on the screen.
  6. From the list, look for wp_options. Note: The table prefix of wp_ may be different if you changed it when installing.
  7. Click on the small icon indicated as Browse.
  8. A screen will open with a list of the fields within the wp_options table.
  9. Under the field option_name, scroll down and look for siteurl.
  10. Click the Edit Field icon which usually is found at the far left at the beginning of the row.
  11. The Edit Field window will appear.
  12. In the input box for option_value, carefully change the URL information to the new address.
  13. Verify this is correct and click Go to save the information.
  14. You should be returned to your wp-options table.
  15. Look for the home field in the table and click Edit Field. Note There are several pages of tables inside wp_options. Look for the > symbol to page through them.
  16. In the input box for option_value, carefully change the URL information to the new address.
  17. Verify this is correct and click Go to save the information.
  18. Delete the folder wp-content/cache (this is a new folder added with WordPress 2.0).
  19. That is it.

Domain Name Change



The following is irreversible. There is no “undo” or “undelete” button. This is permanent. Be warned that it can do harm.

When moving the domain, you will need to restore the database. You then need to upload your files to their new location.

At this point, your blog will NOT work.

  1. Database
    1. Follow the guide above to alter the information in the database.
  2. Database Entries
    1. Log into phpMyAdmin.
    2. Backup your database and save the copy off-site.
    3. Login to phpMyAdmin.
    4. Click the link to your Databases.
    5. A list of your databases will appear. Choose the one that is your WordPress database.
    6. Look for the name of the table within your database used to hold your post information. Usually it is called wp_posts, but it may have been changed. Write it down.
    7. Clicking the Browse icon or link, open the wp_posts table.
    8. Look for the field that holds your post “guid”. It is usually called guid, but it may have been changed. Write it down.
    9. Click the tab at the top for SQL.
    10. Using the information you wrote down from above and the old and new URL addresses you wish to update or search and replace within your database, type in the following (CAREFULLY):
UPDATE wp_posts SET guid = REPLACE (
    1. Make sure that the names of wp-posts and post_content match the tables and fields within your database. Change them if not.
    2. Ensure that the ONLY content you want to change are within the little single ‘quotes’ . Make sure EVERYTHING is spelled right and that you are sure this is correct.
    3. Review everything within the SQL input box again. Make sure it is correct. There are no second changes when you take the next action. The change is permanent.
    4. When you are sure, click Go.
    5. At the top of the screen will be generated a list of how many of the tables and fields have been changed.

Table Prefixes

Like many WordPress administrators, you may be running several of your WordPress domains off of one installation using various wp-config.php hacks. Many of these hacks involve dynamically setting table prefixes, and if you do end up altering your table prefix, you must update several entries within the prefix_usermeta table as well.

As in the above section, remember that SQL changes are permanent and so you should back up your database first:

UPDATE `newprefix_usermeta` SET `meta_key` = REPLACE( `meta_key` , 'oldprefix_', 'newprefix_' );

Changing Template Files

In your WordPress Theme, open each template file and search for any manually entered references to your old domain name and replace it with the new one. Look for specific hand coded links you may have entered on the various template files such as the sidebar.php and footer.php.

WordPress uses a template tag called bloginfo() to automatically generate your site address from information entered in your Administration > Settings > General panel. The tag in your template files will not have to be modified.

Changing the Config file

You will need to update your WordPress configuration file if your database has moved or changed in certain ways.

  1. You will only need to modify the config file if:
    1. your database has moved to another server and is not running on your localhost
    2. you have renamed your database
    3. you have changed the database user name
  2. “‘Make a backup copy of your wp-config.php file.'”
  3. Open the wp-config.php file in a text editor.
  4. Review its contents. In particular, you are looking for the database host entry.
  5. Save the file.

At this point, your WordPress blog should be working.

Verify the Profile

  1. In your Administration Panels go to Settings > General . Here you will verify that the changes you made in Changing the URL above, are correct.
  2. Verify that the reference in your WordPress URL contains the new address.
  3. Verify that the reference in your “Blog URL” contains the new address.
  4. If you have made changes, click Save Changes.

Changing the .htaccess file

After changing the information in your Administration > Settings > General panel, you will need to update your .htaccess file if you are using Permalinks or any rewrites or redirects.

  1. Make a backup copy of your .htaccess file. This is not a recommendation but a requirement.
  2. Open the .htaccess file in a text editor.
  3. Review its contents, looking for any custom rewrites or redirects you entered. Copy these to another text file for safe keeping.
  4. Close the file.
  5. Follow the instructions on the Permalinks SubPanel for updating your Permalinks to the .htaccess file.
  6. Open the new .htaccess file and check to see if your custom rewrites and redirects are still there. If not, copy them from the saved file and paste them into the new .htaccess file.
  7. Make any changes necessary in those custom rewrites and redirects to reflect the new site address.
  8. Save the file.
  9. Test those redirects to ensure they are working.

If you make a mistake, you can Restoring Your Database From Backup from your backup and try this again. So make sure it is right the first time.

Additional Information

Much of this information was taken from Podz’ WordPress Guides where this topic is also discussed.

Some other things you should consider a FULL Search & Replace in your SQL database.

  1. Images link: image links are stored in “post_content” in the wp_posts table. You can use the similar code above to update image links.
  2. wp_options: Besides the “siteurl” and “home” items mentioned above, there are other option_value which also need revision, such as “upload path”, and some plugin items (depends on what you’ve installed, such as widgets, stats, DMSGuestbook, sitemap, etc.)
  3. Do a FULL database search for any items left. MAKE SURE you know what you are changing. and go through each item for possible improper replacement.
Published in: on March 10, 2010 at 10:57 pm  Comments Off on Wordpress Site migration