Question

Database Connection Error

  • Posted February 22, 2020
  • MySQL

Hi, In my website my mysql server sometimes stopping unexpectedly. After some page refreshes then the page will appear. In have changed innodb_buffer_pool_size=20M in my.cnf file.

Subscribe
Share

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.

innodb_buffer_pool_size=20M might be problematic. What’s the droplet size? Have you been able to dig up anything in the error log?

A

Hello, @santsfirm

What you definitely need to do is to examine the MySQL error log and track down any logged errors. The location of the MySQL error log should be:

/var/log/mysql/error.log

but you can also use this command via ssh and it will show you the location of the MySQL error_log:

mysql -se "SHOW VARIABLES" | grep -e log_error

You can check if the droplet/server is not exhausting the memory, a way to check this is using htop / top or free -m

When the issue occurs you can quickly check the memory usage and examine the MySQL error_log as well. If you do not expect a lot of traffic or busy MySQL activity then the error should be logged in the log.

Hope this helps. Let me know how it goes.

Regards, Alex