Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i'm using this sql.. but it does not work

UPDATE wp_options SET option_value = replace(option_value, 'http://old.com, 'http://new.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_options SET option_value = replace(option_value, 'http://old.com', 'http://new.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://old.com,'http://new.com');

UPDATE wp_posts SET guid = replace(guid, 'http://old.com','http://new.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://old.com, 'http://new.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://old.com', 'http://new.com');

UPDATE wp_faquestion SET QuestionAnswer = replace(QuestionAnswer, 'http://old.com, 'http://new.com');

UPDATE wp_faquestion SET QuestionAnswer = replace(QuestionAnswer, 'http://old.com', 'http://new.com');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://old.com, 'http://new.com');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://old.com', 'http://new.com');
share|improve this question
2  
@Beginner Pogrammer the questions like this doesn't help much others to figure out what is wrong with your code. You have to give more context, not just throw in your code, if you work hard on your questions, believe me, people will work hard on their answers. –  Akinator Dec 9 '10 at 1:22
    
This question has been asked and answered a ton of times. Take a look here: wordpress.stackexchange.com/questions/2738/… –  anu Dec 10 '10 at 8:05
add comment

migrated from stackoverflow.com Dec 9 '10 at 22:48

This question came from our site for professional and enthusiast programmers.

3 Answers

up vote 2 down vote accepted

I do this all the time to move a site from our staging server to the live domain.

I use PHPMyAdmin to export the database as an SQL file, then open it up in a text editor and do a global find and replace on the old url to change it to the new url.

The use the SQL script to import the new SQL file to the new database, and copy the file across. Works like magic every time.

share|improve this answer
add comment

How to Export and Import a Wordpress Blog

share|improve this answer
1  
@OMG: note though that I did once exactly this move via Export/Import and the result were less than stellar. First I had to overcome the max upload size of Apache/PHP (the exported XML was much larger than the default 2MB HTTP post size). Then the import had some silent failures I dicovered only later: I noticed that about 5 posts did not make it across (I have no idea why) and there was no warning whatsoever. –  Remus Rusanu Dec 9 '10 at 3:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.