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:
- 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.
- 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 so far) 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.
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"
3. After this step of the tutorial, custom SQL wait for the answer and then check if the site goes in the parameters normal.
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:
-u -c mysqlcheck baza_date wp_options 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 :)