“error establishing a database connection” in a previously working WordPress site

My site just crashed!!! I received the oh-so-helpful error “establishing a database connection” when I went to my site. Other sites on the server were fine.  The site was working fine, and my config had not changed. The httpd error log showed nothing.

Then I found this in the MySQL logs (/var/log/mysqld.log)

[ERROR] /usr/libexec/mysqld: Table ‘./db_name/wp_options’ is marked as crashed and should be repaired

To fix I ran:

mysql -e “use db_name;REPAIR TABLE wp_options”

And we are back . . .

,

2 Responses to “error establishing a database connection” in a previously working WordPress site

  1. Aman June 21, 2011 at 6:45 pm #

    Did you determine the cause?

  2. jbmurphy June 21, 2011 at 6:52 pm #

    Nope. Since it was the wp_options table, I figured the data could be re-created.