Created
January 30, 2014 23:04
-
-
Save pospi/8722004 to your computer and use it in GitHub Desktop.
Some SQL for quickly moving WordPress sites between servers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET @FROMDOMAIN = 'myolddomain.com'; | |
SET @TODOMAIN = 'mynewdomain.com'; | |
SET @FROMSCHEME = 'http'; | |
SET @TOSCHEME = 'http'; | |
#-------------- STANDARD TABLES -------------# | |
UPDATE wp_options | |
SET option_value = CONCAT(@TOSCHEME, '://', @TODOMAIN, '/') | |
WHERE option_name IN('siteurl', 'home'); | |
#------------- MULTISITE TABLES -------------# | |
UPDATE wp_sitemeta | |
SET meta_value = CONCAT(@TOSCHEME, '://', @TODOMAIN, '/') | |
WHERE meta_key = 'siteurl'; | |
UPDATE wp_blogs | |
SET domain = @TODOMAIN | |
WHERE domain = @FROMDOMAIN COLLATE utf8_general_ci; | |
UPDATE wp_site | |
SET domain = @TODOMAIN | |
WHERE domain = @FROMDOMAIN COLLATE utf8_general_ci; | |
UPDATE wp_domain_mapping | |
SET domain = REPLACE(domain, @FROMDOMAIN, @TODOMAIN); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment