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".
Most of the time this error message is caused by a problem in the wp-config file.
Add this code in wp-config.php
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.