I am having 2 applications (Java and PHP). Both are sharing same DB Server. After specific time, both systems stops working due to "Too many connections". I tried so many settings (increased max_connections, maxthreadsperchild, etc) but no luck. When I restart MySQL service, applications start working. When I checked MySQL logs, I can see some connections gets opened and quit. However, after some time, I can see only connections (opened) and not quit

I checked in access logs with same timings and found that these are the same continuous requests where previously connections gets opened and quit also.

All configurations are now set to default.

Please help me to resolve this issue.

Thanks in advance.

  • may you please add more information to your question and add log file and connection sample, as well as my.in\my.cnf – Ahmad Abuhasna May 12 '16 at 8:46
  • "show processlist;" when that happens would tell you - usual suspect is one of the apps spawning multiple instances of some slow query, slowing the server to a crawl and then other queries snowballing from there to a total stop. – jkavalik May 12 '16 at 19:09

Decrease the settings for the web server and Java. Increase max_connections for MySQL.

If you are using Apache, MaxClients should be less than max_connections. You probably can live with small number around 10-20.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.