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! I used Ubuntu server, so after that I just rebooted MySQL server and it works! I was curious and I opened logs, there were more than 5000 lines, but happily I found data about crash and it was something like that:
Of course, I started to google that error and I found the solution! For fixing 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 that actions, you need to reboot your MySQL server!
Now it should work. You can see the difference only on big loading on server, or after few time!