Question

How can I fix "error establishing database connection" ?

I use 512 ram and have 2 websites on Digital ocean and Here I use Webuzo as my panel. The problem comes when I couldn’t open my two sites on wordpress. Error establishing database connection when I tried to open my sites. Please help me… What should I do?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I really don’t understand. Can you help me?

You can use this script to restart your server whenever there is database connection error. https://github.com/Gurnoor30196/Launch-Mysql

something else for others to consider…

After I upgraded my Wordpress one-click install to use 2gb I was getting the same results…after a day I had to reboot my droplet to get my WP site running normally. I then took a look at the apache access.log file and noticed a constant POST to xmlrpc.php from some IP Address.

I did two things to fix this…

  1. I updated iptables to drop the offending IP Address

  2. I restricted access to xmlrpc.php (via apache vhost file) to deny from all; I believe this also disables you from using the mobile app to update your wordpress site as well as other 3rd party services to update WP content…so be careful doing this

Now the problem has gone away :)

There might be some other steps you can do to prevent these type of attacks but these two things worked really well for me. Check your logs to make sure someone is not trying to brute force their way in.