Skip to content

Latest commit

 

History

History
12 lines (10 loc) · 499 Bytes

sql.md

File metadata and controls

12 lines (10 loc) · 499 Bytes

SQL

Update old url to new in wordpress database:

SET @old_url := 'http://localhost';
SET @new_url := 'http://example.com';

UPDATE wp_options SET option_value = replace(option_value, @old_url, @new_url) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, @old_url, @new_url);
UPDATE wp_posts SET post_content = replace(post_content, @old_url, @new_url);
UPDATE wp_postmeta SET meta_value = replace(meta_value, @old_url, @new_url);