Support » Fixing WordPress » SQL Error: Missing wp_comments Table

  • Resolved Gary_Petersen


    One one of my WordPress 2.02 weblogs in which I have comments disabled and have made no changes other than posting articles for weeks, I started getting these two error messages at the top of the admin pages when I log in:

    WordPress database error: [Can’t open file: ‘wp_comments.MYI’ (errno: 145)]
    SELECT COUNT(*) FROM wp_comments WHERE comment_approved = ‘0’

    WordPress database error: [Can’t open file: ‘wp_comments.MYI’ (errno: 145)]
    SELECT COUNT(comment_ID) FROM wp_comments WHERE comment_approved = ‘spam’

    If I go into MySQL and click on the wp_comments database table, I get a similar error:

    #1016 – Can’t open file: ‘wp_comments.MYI’ (errno: 145)

    That table from the database is gone. Or at least it appears to be. I’ve not found anything similar here by searching the forums or codex.

    I can post just fine, but this error message has been consistent for the last few days. I’ve not yet tried to restore the database from a backup. Any thoughts on what this might be?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Errno: 145 indicates that MySQL is unhappy about one of the underlying files used to store data in the database. Oftentimes, you can fix this up by doing a “repair table” yourself.

    However, if the above paragraph reads like greek, contact your host’s tech support. 🙂

    Not completely Greek! 🙂 I’ll give that a shot and see what happens, after backing up again. Thanks.

    It turns out that I didn’t have access to the database in a way that I could repair the table, as suggested. Since comments weren’t allowed on this weblog (announce only), that table was pretty much empty any way, so I deleted the table that was missing then re-created it manually, using another of my weblog tables as a template.

    All is well now. Thanks for the help.

    Arrrghhhhh. I managed to delete my comments table. How do I re-create it?


    I solved my problem by setting up a new blog. Then I exported the comments table. Then I imported the comments table into the old blog. Then I removed all traces of the new blog.

    Nothing better than being able to solve problems by yourself.


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘SQL Error: Missing wp_comments Table’ is closed to new replies.