I have installed wordpress theme and I am getting an error. This is not a constant error. Error appears, then it appears as normal and repeats.
“error establishing a database connection”
Why? please check.
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!
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.
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.
Hi @ssillookboy,
Usually, when you experience such an error it’s related to your MySQL application. Most probably your MySQL is getting killed for some reason, either because it can’t handle the traffic or your Droplet is having high load.
When this happens I recommend SSHing to your Droplet and checking if MySQL is actually running.
The netstat command prints information about our server’s networking system. In this case, you want the names of programs (-p) listening for connections (-l) on a tcp socket (-t). Check the output for a line listing mysqld.
If you find it, you’ll know MySQL is running, if you don’t, then you can start it with:
As mentioned for further debugging you can try and see:
Another thing you can try is to add SWAP to your Droplet. Swap is a portion of hard drive storage that has been set aside for the operating system to temporarily store data that it can no longer hold in RAM. This lets you increase the amount of information that your server can keep in its working memory, with some caveats. The swap space on the hard drive will be used mainly when there is no longer sufficient space in RAM to hold in-use application data.
Hello, @ssillookboy
Can you confirm if the MySQL service is running at the moment? To check run:
You can also check our article on How To Debug the WordPress “Error Establishing Database Connection”
https://www.digitalocean.com/community/tutorials/how-to-debug-the-wordpress-error-establishing-database-connection
Regards, Alex