ASPECT #1
Using MySQL authentication, it is impossible by design. Whenever you get the "Too many connections" error, only one more user can login, and that user must have the SUPER privilege.
For your own protection, only user should have SUPER privilege because that give a user the power to run the following commands:
- CHANGE MASTER TO
- KILL (via mysqladmin or kill other users' sessions)
- PURGE BINARY LOGS
- configuration changes using SET GLOBAL to modify global system variables
- updates on a read-only server
- START SLAVE
- STOP SLAVE
- enabling/disabling logging
- specification of any account in the DEFINER attribute of stored programs and views
This is way too much firepower for any nominal user. Thus, even if all users had SUPER privilege, only one connection beyond max_connections would be allowed to authenticate. The danger of having all users with SUPER privilege becomes apparant when the DBA tries to login and other users with SUPER privileges logs in ahead of you. By restricting mysql to 1 and all users (except root@localhost) being restricted from having SUPER privilege, at least one genuine DBA can login and do things.
Of course, the quick-and-dirty answer would be to find that authentication section of the source code and raise the count from 1 to 10.
ASPECT #2
The next best thing you can do is the following:
Suppose max_connections in /etc/my.cnf is set at 1000. To increase it to 1500, chnage that value in /etc/my.cnf
[mysqld]
max_connections=1500
This may take multiple attempts, but you may want to connect to mysql and run
SET GLOBAL max_conenctions = 1500;
in order to bump up the max_conenctions value.
ASPECT #3
If your monitoring system has to connect to mysql at a fixed interval just to pick up, you will continue having this problem. Try to customize your monitoring so that a constant DB Connection is maintained and is given a heartbeat every 15 seconds. That way, the DB Connection stays up and never competes with other users making connections.