You got error ” too many connections” when connecting to database, when you check the server “show processlist” you see a lot of process having “sleep” status.

Here is the fix:

change wait_timeout in /etc/mysql/my.cnf:

wait_timeout = 600 # if this number is too low , you will get Lost Connection error when doing query

then reboot