WordPress wp_options table corrupted / Error establishing a database connection.

I have heard so far on 2015 have been any virus or exploit SQL to put "down" hundreds of sites 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 databaseError establishing a database connection.
In practice, when such an error occurs on WordPress, the first things to check 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 to stop running. In this case, the service is restarted from terminal (via ssh or the console) or from the web interface if this possibility exists.
  2. Configuration error user / password in wp-config.php. In this situation it is checked if the database user and the database name are set correctly in wp-config.php.

A third situation is corruption (inexplicable so far) table wp_options from MySQL. So, before you panic if you find your site with "Error establishing a database connection ”, it is good to check if the tables in the database are OK.

How to check and repair wp_ tableoptions from WordPress in case it is corrupt. Marked as crashed and should 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 from the database "mobile_apk". Table 'sqldb / wp_options'is marked as crashed and should be repaired.

2. Select table wp_options, by checking the box next to it, then go to the bottom drop-down menu (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

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

  • check if wp_ tableoptions is corrupt:
mysqlcheck -c baza_date wp_options -u user_db -p 
  • fix wp_ tableoptions from the "database" database:
mysqlcheck -r mydb wp_options -u user -p

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 :)

Passionate about technology, I enjoy writing on StealthSettings.com since 2006. I have a rich experience in operating systems: macOS, Windows, and Linux, as well as in programming languages and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, PrestaShop).

How to » net Surfing » WordPress wp_options table corrupted / Error establishing a database connection.

1 thought on "WordPress wp_options table corrupted / Error establishing a database connection. ”

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

    Reply
Leave a Comment