Down site – Error establishing a database connection
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)
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
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 220.127.116.11:47686] WordPress database error Lost connection to MySQL server during query for query select val from wpwfConfig where name=‘disableConfigCaching’ made by include('wp-load.php’), requireonce('wp-config.php’), requireonce('wp-settings.php’), includeonce(’/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 :(
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.×