WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to do a "content only" restore using only phpMyAdmin? (7 posts)

  1. dma999999
    Member
    Posted 4 years ago #

    I was hoping someone might be able to help with the following situation:

    Recently, my hosting service provider managed to somehow mess up my site. The result was a non-working WordPress install. I was however able to get into the service provider's admin interface to create a full backup of the mysql database.

    After thinking it through a bit, I decided to do a "clean" install of WordPress from scratch. Over the years, there was a lot of stuff that had accumulated that I thought would probably be better not to have. In addition, I did some clean up, changed the domain name, changed the default database name (as recommended in the install guide) and basically did a bunch of clean up I should have done years ago.

    Unfortunately, what I have not been able to figure out is how to get all of my old content back in to my new install. While I have found the howto on restoring a MySQL backup using phpMyAdmin, that isn't quite what I want to do, since I don't want the old URL references, etc. Just purely the content - posts, pages, comments, custom fields and tags. Basically, what using the "import" function in WP Admin would probably accomplish (which I don't think I can use given that I only have a .sql backup).

    When I read the stuff on restoring a database, it doesn't seem like it would work, as the table names are all different, etc. There are also tables from the old install relating to plugins I haven't used for ages, etc.

    So, I guess to be more precise, I'm trying to find out if there's a way to use phpMyAdmin or something else to import content only into a fresh WP install. I suspect it might involve selectively restoring certain tables only from the backup, and possibly renaming tables (don't even know if that's possible - my mySQL-fu is weak) and perhaps other stuff?

    If anyone has any guidance on how to do this, or could point me in the right direction to learn how to myself, I'd certainly appreciate it.

    Thanks

  2. whooami
    Member
    Posted 4 years ago #

    are they the same wordpress versions?

    if not, is the old one web accessible, and what version is it, specifically?

  3. Pranav Rastogi
    Member
    Posted 4 years ago #

    You can insert wp_posts, wp_postmeta and some other tables like terms, etc. to your new database or simply import the database you exported to your new database.
    It will add the tables and rows which are not present.

  4. dma999999
    Member
    Posted 4 years ago #

    whooami: Thanks for the note. Well, they were until yesterday when I implemented 2.8.1. Yikes. Unfortunately no the older one is not web accessible. I do have a backup though.

    ulgaming: Thanks for that. I have used phpMyAdmin to import the entire old DB into the new one. However, the table names are different. In the new one, there is a tb_ prefix, while the old one used wp_. Is there a way to copy or inject the records from one of the old tables into one of the new ones, or delete the new table and rename the old one with the new name (e.g. delete existing tb_posts, and rename old wp_posts to tb_posts)? Might there be any problems caused by this approach?

  5. Pranav Rastogi
    Member
    Posted 4 years ago #

    You can try to delete wp_posts and rename tb_posts to wp_posts. If it doesn't work, you can just install a fresh WordPress again and import.

  6. dma999999
    Member
    Posted 4 years ago #

    Thank you! It worked wonderfully. Most appreciated!

  7. Pranav Rastogi
    Member
    Posted 4 years ago #

    Glad to help. Please mark this topic as resolved. :)

Topic Closed

This topic has been closed to new replies.

About this Topic