WordPress wp_options corrupted table / Error establishing a database connection.

I have heard so far on 2015 have been any virus or exploit SQL to put "down" hundreds of websites and blogs WordPress, As it was in previous years, but about a month strange things occur. I met many sites that seemed lost the connection to the database. Error Establishing a database connection.
In practice, when such an error occurs on WordPress, the first things to check out are:

  1. if service mysql Server-side. There are situations in which the server overload which it is the host of the database service mysql / mysqld do not run anymore. In this case, the terminal service (via ssh or console) is restarted or the web interface if this possibility exists.
  2. Configuration error user / password in wp-config.php. In this case, check that the database user and the database name are correctly set in wp-config.php.

A third situation is corruption (unexplained until now) of the table wp_options from MySQL. So before you panic if you find the site with "Error establishing a database connection", you should check that the database tables are okay.

Such as checking and repair of WordPress wp_options table in case it is corrupted. Marked as crashed and shouldnt BE repaired.

1. open phpMyAdminWe go on the database of the site that is down and attempt to access the table wp_options. If it is corrupt, an alert will appear that informs this.

Screen Shot at 2015 12-16-6.32.25 PM

In the above screen is about Table wp_options database "mobile_apk" Table 'sqldb / wp_options' is marked as crashed and repaired shouldnt BE.

2. Select the table wp_optionsBy checking the box next to it, then go to the bottom of the dropdown (With selected) and select 'Repair table"

sql_repair_table_wp_options

3. After this step of the tutorial, custom SQL wait for the answer and then check if the site goes in the parameters normal.

Screen Shot at 2015 12-16-6.33.15 PM

WordPress users who do not have phpMyAdmin installed can do so from the terminal / server on which the database is based by executing the commands:

  • wp_options check if table is corrupted:

mysqlcheck -c base_date wp_options -u user_db -p

  • wp_options repair the database table "baza_date"

mysqlcheck r -u user -p mydb wp_options

It is good that after ensuring that the site returned to normal to make a backup of the database. even recommend regular backups. You never know :)

WordPress wp_options corrupted table / Error establishing a database connection.

About the author

Stealth

Passionate about everything that means gadgets and IT, I write with pleasure stealthsettings.com from 2006 and I like to discover with you new things about computers and operating systems macOS, Linux, Windows, iOS and Android.

Comment

  • WHY does this happen, though? I've been experiencing this with multiple sites for a client that are all hosted on a Godaddy server. Fixing it is easy enough, but what makes it corrupt in the first place and how can I prevent it from happening again?

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment is processed.