Uh Oh! MySQL stopped connecting, now what?!? This scenario happened to us on our new AWS platform so we decided to dig a little further into the problem. Every 4-6 hours we would get a notice from our monitoring platform that we are receiving an error 500 on our website. When we check the site in a web browser, we see an error that WordPress can not connect to the MySQL database. That’s scary as we haven’t changed anything on our server, or our site to have any conflicts!
Did we get hacked, did we break something that we weren’t aware of?!?
NOPE, the answer was actually that we ended up reaching our servers soft limit for open files, we’ll explain that in a little bit. To determine if this is what has happened to you, before you restart your server or MySQL, check your server’s “/var/lib/mysql/hostname.err“