Changing the domain of a WordPress site with phpmyadmin sql commands

edited August 2016 in Web Development

To change the URL or domain name used for your WordPress site in 2 easy commands. Login into phpmyadmin and click on the "sql' tab at the top menu.

  1. Paste the below command changing the domains with your domains. This will update all media and post links.
UPDATE wp_posts SET post_content = REPLACE (
post_content,
'old domain URL here',
'new domain URL here');
  1. Paste the below command changing the domains with your domains. This will update main site url and homepage url.
UPDATE wp_options
SET option_value = 'new domain URL here'
WHERE option_value = 'old domain URL here'
Tagged:
Sign In or Register to comment.