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);
yourdomain.com/wp-admin/maint/repair.php
Click repair and optimize button to repair your database.
If you still have this issues, contact your hosting provider. They will fix this easily.