Skip to content

Instantly share code, notes, and snippets.

@nguyentienlong
Created February 19, 2017 02:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nguyentienlong/f37da6a919ed6b44244a83e7dac25abe to your computer and use it in GitHub Desktop.
Save nguyentienlong/f37da6a919ed6b44244a83e7dac25abe to your computer and use it in GitHub Desktop.
wordpress - update mysql database when changing domain
UPDATE wp_posts SET guid = replace(guid, 'http://old-domain','http://new-domain');
UPDATE wp_posts SET post_content = replace(post_content, 'http://old-domain', 'http://new-domain');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://old-domain','http://new-domain');
UPDATE wp_options set option_value='http://new-domain' where option_name in ('siteurl', 'home');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment