• Resolved lwuun

    (@lwuun)


    Hi,

    I didn’t update my wordpress for ages last year and so it was hacked. I left it for a while and went to work with it again now. I took all the wordpress files off my server, and uploaded the whole new wordpress package.

    Then I emptied all tables in my wordpress database because I don’t know what the hacker messed with except my home page and wpadmin password. Except wp_posts. It still has all my posts and I would love to be able to not have to copy them manually, and I figured they might just show up if I left it like that, so I’ve left that one as it is.

    I installed wordpress and only got round to creating the config file when I got this error when I try to go straight to the website, http://www.lwuun.net:
    “Error establishing a database connection”

    And this when I go to wp-admin:
    “One or more database tables are unavailable. The database may need to be repaired.”

    I have repaired all the tables multiple times both through wordpress and through phpmyadmin; and I have checked whether the problem is the connection *with* the database but it is not. It is also not a problem with the info I filled out in wpconfig as this is the exact same info I used to have in there pre-hack when everything worked just fine and that hasn’t been changed.

    Then I saw, as I was trying all these different fix-database tips online, that I missed e.g. siteurl in wp_options (one tip was to change the siteurl). Now I’m thinking that I may be missing way more rows, perhaps in more than one table, maybe due to the fact that I deleted the content of the tables earlier, or maybe because I deleted all the content except wp_posts? For instance, I only have two rows in wp_options now, four under terms, three under term_relationships, four under usermeta. Is that perhaps the problem?

    Thank you for your time!

Viewing 2 replies - 1 through 2 (of 2 total)
  • I think you what have there is going to be hard to fix in the way it sounds you are doing, as the database is relational, i.e., the wp_posts table refers to information in other tables, for example the wp_post_meta table. Now from what I gather you did not keep the wp_post_meta table from the old installation? If that is true, then importing just the old wp_posts table may not work, as the old wp_posts file may contain post IDs that are already in use in your new WordPress install.

    I would suggest you first install a completely blank new WordPress, and see that it is working before you start to introduce your saved table information, and then delete the sample post.

    Then, you can try and import the old wp_posts table, assuming you have the .sql for that table (which I think you do from your description). This will create new entires provided there is no collision of the primary key field “ID” in the new WordPress wp_posts table.

    If there is none, and the .sql file imports successfully, you will have all your posts, but no meta-data about them (such as any custom fields you may have had on your old WordPress site). Additionally, comments are generally stored in wp_comments so if you deleted that table as well, you will only have the comments count for each post, but no longer the actual comments.

    Depending how many posts you had on your old install, you may be better off just copying and pasting the old posts back into the new install, which will create all the references to other database tables correctly.

    Thread Starter lwuun

    (@lwuun)

    Whoopee! I did what you said + dropped all tables before reinstalling and that all worked out just fine, incl. importing wp_posts and wp_comments. Thanks so much! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Reinstalled wordpress, database error, tables maybe not filled?’ is closed to new replies.