Recovering posts from a dead Wordpress blog
August 12, 2009 2:22 PM   Subscribe

Is there an easy way to export Wordpress posts when the admin panel is crashed and I have only command line access?

I accidentally messed up the MySQL database for my Wordpress blog. The posts are all there to read on the blog, but I can't get into the panel (which is now in a "you don't have permissions" state that I don't think I can fix because it's not for one of the usual reasons.)

So I installed a new Wordpress system in a different directory. Now I would like it to grab all the posts from the other Wordpress, either by grabbing it off the database or (preferably) just using some plugin that would extract posts from the Web site.

Is there a good way to do this? Any help much appreciated.

(I'd hook it up to the old MySQL database, but I'm concerned this would put it in the same dead situation.)
posted by johngoren to Computers & Internet (5 answers total) 1 user marked this as a favorite
This article from Wordpress talks about backing up your DB from the command line. It is very straight forward.
posted by avex at 3:01 PM on August 12, 2009

Response by poster: Thanks, but with the DB broken, I think I'd only be backing up a dead DB. :(
posted by johngoren at 3:21 PM on August 12, 2009

The DB isn't dead. You said yourself that you can see all the posts. Most likely some of the permissions are just set incorrectly. You could try just exporting/importing the tables that contain post data (e.g. wp_posts, wp_comments) and not the ones like wp_usermeta that contain permissions. Read the man page for mysqldump and you'll see that you can specify a list of tables if you aren't exporting the whole database. This is also much easier if you have phpmyadmin.
posted by Rhomboid at 3:53 PM on August 12, 2009

What do you mean by "messed up the MySQL database"? What did you do to break it? Change permissions, or remove a table, etc.?

As Rhomboid says, you should be able to dump out the data, but if you changed something (rather than MySQL randomly breaking, in which case you'll want to repair some tables) then you need to be careful to copy things across in a way that doesn't copy the problem.
I'm not sure switching over to a fresh WP is necessarily the best approach, it might be better to fix the broken bits by referring to the fresh WP, especially if it helps avoid a URL change.

And definitely use PHPMyAdmin if your hosting firm offers it (probably does), it's easier than facing a command line.
posted by malevolent at 11:53 PM on August 12, 2009

which is now in a "you don't have permissions" state

Can you use the command line to edit/create an admin user? It sounds like it's just the User that doesn't have permissions - nothing wrong with the DB, just one or two bits of the data.
posted by mikewas at 10:02 AM on August 13, 2009

« Older if u live on the road theres a new highway code   |   Don't bogart the pot(s)! Newer »
This thread is closed to new comments.