A few days ago, I was doing some changes on my site, and suddenly it went out with words: “Database connection failed!”, I was so surprised! But after the rebooting my server, it started to work, like nothing happened! But by my experience, I was sure, that it will happen again!  So, I was very curious and I opened the MySQL logs, there were more than 5000 lines, but happily, I found the information about the server crash and it was something like that:

Of course, I’ve started to google that error and I found the solution! To fix it, you need to go to: /etc/mysql/conf.d/ , and create file my.cnf, then you need to put that code into the file:

[mysqld]
max_connections = 50
max_user_connections  = 10
innodb_buffer_pool_size = 32M

After all of the changes, you need to reboot your MySQL server!

Now it should work. You can see the difference only on when you will have a lot of traffic on the server, or after some time!

Did you enjoy this article?
Signup today and receive free updates straight in your inbox. We will never share or sell your email address.
I agree to have my personal information transfered to MailChimp ( more information )