Error Establishing Database Connection

My Website Is Frequently Going Down When I Get High Traffic,It Give error establishing database connection…when i restart web server and droplet it is working back…i would like to know why is it going down,what should i do to solve this problem? iam using apache web server 80$ Digital Ocean Plan And Cloudflare Of Free Service

My Web Site Gets 50K-90K Page Views Daily…Plz Help me Solve This Issue


Submit an 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.

“Error establishing database connection” in WordPress can often result from your server running out of memory and having to kill MySQL. If you see it happening when your server is getting a lot of traffic, you should try using caching plugins such as WP Super Cache or WP Rocket configured to cache pages as static files.

The problem is likely only that your site’s PHP code can’t handle the volume of requests it’s getting with your particular server hardware and configuration. So, a great solution is to keep requests from hitting PHP at all by using WordPress caching plugins.

Stop being a cheapskate and hire a proper sysadmin, with 50-90k page views a day that should not be much of an issue :)