How can I restore ONE blog post from wrdp1.sql?

Discussion in 'MySQL' started by FlashDriveDT, Jun 25, 2009.

  1. #1
    Since Im a complete newbie to this I greatly appreciate anyones help. I accidently deleted a blog post of mine but luckily I have a fairly recent backup from hostgator. When I go through that tar.gz file I see a folder "mysql" with a very large file named xxx_wrdp1.sql (xxx stands for my user name). I assume that's where all my post text is in. But how can I access this database and then only this one post and restore it to my website? I found this article --> Restore ONE post? but it leaves me utterly clueless.

    To clarify - I do not want to overwrite my whole site as I added new stuff since that last backup, I only want to re-add that one post. Can this be done in an easy way? Like copy and paste? Please provide step by step instructions if possible or point me to a good guide on the web. Thanks a lot!
     
    FlashDriveDT, Jun 25, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Decompress the tgz file, and find the insert statement for the blog post you want to restore. winrar, winzip and a few other programs can decompress the tgz file for you if you dont have a program that can do it. Open the wp-posts file into a text editor, select and copy the insert statement for the post you lost.. Then use phpmyadmin or another sql command line prompt, to enter / upload the post that you deleted.
     
    jestep, Jun 25, 2009 IP
  3. FlashDriveDT

    FlashDriveDT Peon

    Messages:
    61
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I already decompressed the whole backup tgz. So I take it the wp-posts file and insert statement is in the xxx_wrdp1.sql file? My sql file is 474 MB big so how do I just open it? When I try to do it with notepad it takes ages.
     
    FlashDriveDT, Jun 25, 2009 IP
  4. FlashDriveDT

    FlashDriveDT Peon

    Messages:
    61
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Nevermind. When I woke up this morning I had an ingenious moment of clarity. The voice in my head said "Why don't you find the cached version of your post on google". And voila, there it was. :D And I didn't even have to resort to copying from there because I found out on my wordpress that it saves all revisions of posts. So all I had to do is open up an older revision of my post and paste it. Sweet! :)

    I probably could have redone my post via the database too as I was able to open the sql file in notepad. I found the post entry and would have been able to copy and paste. However it does have some elements in there that mess with the html code ("c/n/r/" ?). But it's not hard to erase them I figure. Anyway, problem solved! :D
     
    FlashDriveDT, Jun 26, 2009 IP
  5. alfa_375

    alfa_375 Active Member

    Messages:
    445
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #5
    Wel done nice idea. Could you explain little more about the google caching.
     
    alfa_375, Jun 27, 2009 IP