Move posts via database?

9 replies
Hi,

This will probably sound like s stupid question to some of you, but hey, I know almost nothing about databases and I need to know!:confused:
I have to move all the posts from an old blog with a tired domain name to a new blog with a new domain name.
Now, I know I have to do redirects which is fine.
My question is this:
Do I have to upload each post one at a time, or is there a shortcut I can use by transferring the posts from the MySQL database on the old blog to the database at the new blog?

Any advice would be really welcome.

thanks
#database #move #mysql database #posts
  • Profile picture of the author mywebwork
    If you are speaking about WordPress and you are moving your site to another domain, then what you need to do is replace every instance of the old domain name with the new one in the database.

    You can do this by (a) using PHP MyAdmin to export the entire database to a text file, (b) using a text editor to do a "search & replace" for the new domain name and (c) importing the edited file to your (empty) database on your new site.

    If you need assistance with this please let me know.

    Bill
    {{ DiscussionBoard.errors[2162231].message }}
    • Profile picture of the author Infobond
      Hi Bill,

      I knew there had to be a way but I couldn't see how!
      Wow!!!
      Thank you so much.
      With over 200 posts this is going to save so much work!
      {{ DiscussionBoard.errors[2162436].message }}
  • Profile picture of the author mywebwork
    My pleasure!

    One thing I didn't mention (but that you probably figured out anyway) is that you also need to copy all the files from your old WordPress installation to the new site so that all the themes and plugins stay intact. Once it's moved just edit the wp-config.php file to use the new database login information.

    Bill
    {{ DiscussionBoard.errors[2162453].message }}
    • Profile picture of the author Infobond
      Hi Bill,

      I did what you said - downloaded a text file (6.4Mb, phew!), edited using search and replace and then tried to upload this edited file to the new database.

      I get this error message:

      Error

      SQL query:

      "1";

      MySQL said: Documentation
      #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 '"1"' at line 1


      I'm lost now :-(


      Any advice would be appreciated.


      Thanks


      Pete
      {{ DiscussionBoard.errors[2169718].message }}
      • Profile picture of the author Infobond
        Hi Bill,

        Just a thought:
        Is it possible to do this through phpMyAdmin?

        Pete
        {{ DiscussionBoard.errors[2169722].message }}
  • Profile picture of the author newmoon
    Currently I am working on a project to easily migrate wordpress installations. I believe once it is out, you will find easy to do same.


    you need to update the options table after you copy your wordpress database. two fields need to update.
    siteurl and home

    and update your configuration file, wp-config.php. other things can remain same for time being.
    {{ DiscussionBoard.errors[2162691].message }}
  • Profile picture of the author mywebwork
    Hi Pete

    Yes, PHP MyAdmin is teh easiest way to do this:

    1 - Export you old database as a .sql file
    2 - Use your text editor (i.e. Notepad++, PD Pad, Ultra Edit) to change all the instances of the old domain name to the new one.
    3- Save the file
    4 - Import the resulting file into your new blank database on the new site, also using PHP My Admin


    If you get really stuck shoot me a PM and I can probably do it for you - I'll be away from the computer for most of the day today however but will be online all day tomorow.

    Bill
    {{ DiscussionBoard.errors[2169936].message }}
  • Profile picture of the author Luke Graham
    There are full details of moving wordpress to a new server/domain on the codex webpages which you might find useful -

    Moving WordPress WordPress Codex
    Signature
    Best Ways To Make Money Online

    Eight bytes walk into a bar. The bartender asks, “Can I get you anything?”
    “Yeah,” reply the bytes. “Make us a double.”
    {{ DiscussionBoard.errors[2170165].message }}
  • Profile picture of the author Infobond
    Hi Luke,

    Thank you for the link.
    Very helpful :-)

    Pete
    {{ DiscussionBoard.errors[2170421].message }}

Trending Topics