Moving Your WordPress Site: Updating the Database

October 10th, 2007

wordpress-logo-cristal.jpgWhen moving your WordPress blog to a new location on your server, you will need to update all the references in the database. The following MySql script can help with this task. Just run the following MySql in your query tool of choice. Make sure to replace the appropriate URLs.

UPDATE yourdb.wp_posts SET guid = REPLACE (guid, ‘http://yourdomain.com/oldlocation’, ‘http://yourdomain.com/newlocation’);

UPDATE yourdb.wp_posts SET post_content = REPLACE (post_content, ‘http://yourdomain.com/oldlocation’, ‘http://yourdomain.com/newlocation’);

Leave a Reply

Spam protection by WP Captcha-Free