Skip to content

Instantly share code, notes, and snippets.

@simonpioli
Created March 13, 2013 10:06
Show Gist options
  • Save simonpioli/5150752 to your computer and use it in GitHub Desktop.
Save simonpioli/5150752 to your computer and use it in GitHub Desktop.
Wordpress DB Migration
SET @from_host = 'old-host.com';
SET @to_host = 'new-host.com';
UPDATE `wp_options` SET `option_value` = REPLACE(`option_value`, @from_host, @to_host);
UPDATE `wp_posts` SET `guid` = REPLACE(`guid`, @from_host, @to_host);
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`, @from_host, @to_host);
UPDATE `wp_comments` SET `comment_author_url` = REPLACE(`comment_author_url`, @from_host, @to_host);
UPDATE `wp_comments` SET `comment_content` = REPLACE(`comment_content`, @from_host, @to_host);
UPDATE `wp_links` SET `link_url` = REPLACE(`link_url`, @from_host, @to_host);
UPDATE `wp_postmeta` SET `meta_value` = REPLACE(`meta_value`, @from_host, @to_host);
UPDATE `wp_usermeta` SET `meta_value` = REPLACE(`meta_value`, @from_host, @to_host);
UPDATE `wp_commentmeta` SET `meta_value` = REPLACE(`meta_value`, @from_host, @to_host);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment