Ghanshyamji Gupta Ghanshyamji Gupta - 4 months ago 7x
SQL Question

Error establishing in database connection

I have a Wordpress site which works perfectly. But some times when I refresh the page several times using F5 key, then my site goes down for several minutes or for about half an hour and shows message

"Error establishing in database connection".

My database user name , password , host etc all are right. And my site works perfectly. But it shows this error only some times. If database connection are not perfect then it must show this message all the time. I have also written custom database connection in seperate files.


Most of the time this error message is caused by a problem in the wp-config file.

Add this code in wp-config.php

define(‘WP_ALLOW_REPAIR’, true);

Click repair and optimize button to repair your database.

Make sure you remove this line of code after you have fixed your database connection error message.

If you still have this issues, contact your hosting provider. They will fix this easily.