0

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');
2
  • 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, 2010 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, 2010 at 8:05

3 Answers 3

2

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.

2

How to Export and Import a Wordpress Blog

1
  • 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, 2010 at 3:19
1

http://codex.wordpress.org/Moving_WordPress

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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