Report this

What is the reason for this report?

Down site – Error establishing a database connection

Posted on November 1, 2015

Hi all! So, my site has been down several times this past few days. I am running a self hosted wordpress site using Umbuntu.

The other day I had an error establishing a database connection so when I run curl -I and tail, I didn’t saw anything particular so when I restarted the apache the site run back normally.

However, today the site was down again and when I run tail it showed that apparently I lost connection to MySql database therefore I did a series of apache and mysql restarting and now my site is back again.

My question is, what normally drives this kind of errors and if ever there is a problem with mysql, how can I fix this? Below are the logs from the latest moment my site was down.

It is down again and when I try curl:

HTTP/1.1 500 Internal Server Error Date: Sun, 01 Nov 2015 08:36:40 GMT Server: Apache/2.4.7 (Ubuntu) X-Powered-By: PHP/5.5.9-1ubuntu4.11 Expires: Wed, 11 Jan 1984 05:00:00 GMT Cache-Control: no-cache, must-revalidate, max-age=0 Pragma: no-cache Connection: close Content-Type: text/html; charset=utf-8

And here’s the tail result:

[Sun Nov 01 07:10:58.648191 2015] [:error] [pid 17859] [client 5.8.66.115:47686] WordPress database error Lost connection to MySQL server during query for query select val from wp_wfConfig where name=‘disableConfigCaching’ made by include(‘wp-load.php’), require_once(‘wp-config.php’), require_once(‘wp-settings.php’), include_once(‘/plugins/wordfence/wordfence.php’), wordfence::install_actions, wfCache::setupCaching, wfConfig::get, wfDB->querySingle

I don’t understand most of the problem which the tail gave me except for the lost server from MySql. I wish to fix this problem and I think restarting it is just something temporary because if there’s something bigger behind this downtime, I really wish to fix now.

This forum has been so helpful and I really enjoy the learning progress everytime I recieve a downtime but recently I’m getting quite a bit of traffic and the down time has been affecting the flow :(

Thanks all!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I’m receiving some heavy traffic from the same IP (5.8.66.115) :(

5.8.66.115 - - [02/Nov/2015:16:42:44 -0500] "POST /xmlrpc.php HTTP/1.0" 404 463 "-" "Mozilla/4.0 (compatible: MSIE 7.0; Windows NT 6.0)"
5.8.66.115 - - [02/Nov/2015:16:42:45 -0500] "POST /xmlrpc.php HTTP/1.0" 404 463 "-" "Mozilla/4.0 (compatible: MSIE 7.0; Windows NT 6.0)"
5.8.66.115 - - [02/Nov/2015:16:42:46 -0500] "POST /xmlrpc.php HTTP/1.0" 404 463 "-" "Mozilla/4.0 (compatible: MSIE 7.0; Windows NT 6.0)"
5.8.66.115 - - [02/Nov/2015:16:42:47 -0500] "POST /xmlrpc.php HTTP/1.0" 404 463 "-" "Mozilla/4.0 (compatible: MSIE 7.0; Windows NT 6.0)"
5.8.66.115 - - [02/Nov/2015:16:42:49 -0500] "POST /xmlrpc.php HTTP/1.0" 404 463 "-" "Mozilla/4.0 (compatible: MSIE 7.0; Windows NT 6.0)"
5.8.66.115 - - [02/Nov/2015:16:42:49 -0500] "POST /xmlrpc.php HTTP/1.0" 404 463 "-" "Mozilla/4.0 (compatible: MSIE 7.0; Windows NT 6.0)"
5.8.66.115 - - [02/Nov/2015:16:42:49 -0500] "POST /xmlrpc.php HTTP/1.0" 404 463 "-" "Mozilla/4.0 (compatible: MSIE 7.0; Windows NT 6.0)"

Maybe late answer, but you could try to change the value for php fpm in www.conf.

Change: pm.max_children = 100 pm.start_servers = 20

To: pm.max_children = 10 pm.start_servers = 10

This will avoid php to eat your memory when you got more traffic to the site.

Most likely OOM killer, check your syslog.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.