How do I avoid the "too many connections" error message is shown? How do I avoid the following error message is shown to normal users?


  PDOException: SQLSTATE[HY000] [1040] Too many connections in lock_may_be_available()
There are two issues here:


Users are seeing site error messages that they shouldn't
The error message itself


For 1, go to admin/config/development/logging and set Error messages to display to None.  Don't worry, this won't affect messages like "incorrect login details" or "page not found, we did a search instead" ... things that the user really needs to know.

As for 2, here are a couple of things to try:


Turn off all your custom modules if you have any, re-enable them one by one to see if you can find the cause
Do the same with contributed modules
Read up on the error message, there are too many things that could be causing it that are non-drupal specific to be useful on this site.