MySQL transfer help
-
Trying to transfer my database from http://www.howardcountychildrenscenter.com/wordpress to http://www.howardcountychildrenscenter.com/
so basically from a subfolder to the root. The files have already been moved and a new database created. The problem is i need to change all the urls to reflect the new address. I keep getting errors on my sql queries i try…usually about some character is in the wrong spot…on 2 of 3 different one’s i’ve tried such as: UPDATE wp_options SET option_value = replace(option_value, ‘http://www.oldurl’, ‘http://www.newurl’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
UPDATE wp_posts SET guid = replace(guid, ‘http://www.oldurl’,’http://www.newurl’);
UPDATE wp_posts SET post_content = replace(post_content, ‘http://www.oldurl’, ‘http://www.newurl’);
UPDATE wp_postmeta SET meta_value = replace(meta_value,’http://www.oldurl’,’http://www.newurl’);
or this: SET @from_host = ‘www.oldhost.com’;
SET @to_host = ‘www.newhost.com’;
UPDATE
wp_optionsSEToption_value= REPLACE(option_value, @from_host, @to_host);UPDATE
wp_postsSETguid= REPLACE(guid, @from_host, @to_host);UPDATE
wp_postsSETpost_content= REPLACE(post_content, @from_host, @to_host);UPDATE
wp_commentsSETcomment_author_url= REPLACE(comment_author_url, @from_host, @to_host);UPDATE
wp_commentsSETcomment_content= REPLACE(comment_content, @from_host, @to_host);UPDATE
wp_linksSETlink_url= REPLACE(link_url, @from_host, @to_host);UPDATE
wp_postmetaSETmeta_value= REPLACE(meta_value, @from_host, @to_host);UPDATE
wp_usermetaSETmeta_value= REPLACE(meta_value, @from_host, @to_host);UPDATE
wp_commentmetaSETmeta_value= REPLACE(meta_value, @from_host, @to_host);here is the exact error for the 2nd one:
There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem
ERROR: Unclosed quote @ 18
STR: ‘
SQL: SET @from_host = \’www.oldhost.com\’;SET @to_host = \’www.newhost.com\’;
UPDATE
wp_optionsSEToption_value= REPLACE(option_value, @from_host, @to_host);UPDATE
wp_postsSETguid= REPLACE(guid, @from_host, @to_host);UPDATE
wp_postsSETpost_content= REPLACE(post_content, @from_host, @to_host);UPDATE
wp_commentsSETcomment_author_url= REPLACE(comment_author_url, @from_host, @to_host);UPDATE
wp_commentsSETcomment_content= REPLACE(comment_content, @from_host, @to_host);UPDATE
wp_linksSETlink_url= REPLACE(link_url, @from_host, @to_host);UPDATE
wp_postmetaSETmeta_value= REPLACE(meta_value, @from_host, @to_host);UPDATE
wp_usermetaSETmeta_value= REPLACE(meta_value, @from_host, @to_host);UPDATE
wp_commentmetaSETmeta_value= REPLACE(meta_value, @from_host, @to_host);SQL query:
SET @from_host = \’www.oldhost.com\’; SET @to_host = \’www.newhost.com\’; UPDATE
wp_optionsSEToption_value= REPLACE(option_value, @from_host, @to_host); UPDATEwp_postsSETguid= REPLACE(guid, @from_host, @to_host); UPDATEwp_postsSETpost_content= REPLACE(post_content, @from_host, @to_host); UPDATEwp_commentsSETcomment_author_url= REPLACE(comment_author_url, @from_host, @to_host); UPDATEwp_commentsSETcomment_content= REPLACE(comment_content, @from_host, @to_host); UPDATEwp_linksSETlink_url= REPLACE(link_url, @from_host, @to_host); UPDATEwp_postmetaSETmeta_value= REPLACE(meta_value, @from_host, @to_host); UPDATEwp_usermetaSETmeta_value= REPLACE(meta_value, @from_host, @to_host); UPDATEwp_commentmetaSETmeta_value= REPLACE(meta_value, @from_host, @to_host);MySQL said:
#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘\’www.oldhost.com\’;
SET @to_host = \’www.newhost.com\’;
UPDATE `wp_opti’ at line 1
thanks for your help!
The topic ‘MySQL transfer help’ is closed to new replies.