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.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hi @app260866,
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:
https://www.digitalocean.com/products/managed-databases-mysql/
Source: https://www.digitalocean.com/community/questions/how-to-tweak-mysql-mariadb-configuration-for-increased-performance-and-stability
Additionally, answer taken from @bobbyiliev from this question :
Hello, @app260866
If you’re using Ubuntu the path to the MySQL errog_log should be
/var/log/mysql/error.log
so if you want to check the last 100 entries of the log you can use the following commandand monitor it in real-time:
Hope that this helps! Regards, Alex
Hi @app260866,
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.
Regards, KFSys