What MySQL/SQL Query to do a simple find and replace

👉  MySQL/SQL Query to do a simple find and replace localhost to live data / change url / domain.

 

  • "UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com',  
    'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl'";
  • "UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com')"; 
  • "UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com',  
    'http://newdomain.com')"; 
  • "UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 
     'http://newdomain.com')";

 run above queries in your phpmyadmin , and you got results. 😊

Comments