I recently set up a wordpress website and occasionally I get the above error message. That is initially I get connected without any problem and after a few minutes the server is not responding returning the above error. When I’m trying to log in again there is no response but after a few minutes everything works ok again. This"loop"process keep happening.
Can you please provide me with a solution to this problem?
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.
This crash is most likely due to your system running out of memory. I’d suggest that you add a swap file to give yourself a bit more of a buffer. Check out this tutorial:
How To Add Swap on Ubuntu 18.04
What you can also do is to use the MySQLTuner script.
The MySQLTuner is a script written in Perl and allows you to quickly test your MySQL configuration and it gives you suggestions for adjustments to increase performance and stability.
According to the official GitHub page, it supports 300 indicators for MySQL/MariaDB/Percona Server in this last version.
To run the script you could do the following:
The script would run multiple checks against your MySQL instance, all checks done by MySQLTuner are documented here.
Also as stated in the official documentation, it is still extremely important for you to fully understand each change you make to a MySQL database server. If you don’t understand portions of the script’s output, or if you don’t understand the recommendations, you should consult a knowledgeable DBA or system administrator that you trust.
As a good practice make sure to always test your changes on staging environments before implementing them on your production database.
On the same note, if you want to have worry-free MySQL hosting and focus on your application, I would recommend trying out the DigitalOcean Managed Databases:
Additionally, answer taken from @bobbyiliev from this question :
If you’re using Ubuntu the path to the MySQL errog_log should be
/var/log/mysql/error.logso if you want to check the last 100 entries of the log you can use the following command
and monitor it in real-time:
Hope that this helps! Regards, Alex
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.
Sign up now
This looks like your Database server is crashing and restarting itself.
I’ll recommend checking your MySQL/MariaDB error logs to see what’s going on. Basically, SSH to your droplet and tail the log:
And when your Website displays an error establishing a database connection, you’ll see what was the error once it’s logged.
Reasons behind these failures might be memory or CPU shortage, you might need to upgrade if your Website is too heavy or maybe there is an issue with some of the Databases inside your MySQL/MariaDB instance but again this will be logged in your error_log.