If clients face Too many connections errors when attempting to connect to the mysql server,
all available connections are in use by others.The number of connections which we have configured is controlled by the max_connections system variable.
Actually the default value is 151 to improve performance when MySQL is used with the Apache Web server. To support more connections, configure max_connections to a
larger number.
show variables like “max_connections”;
If the limit of max_connections get completed you will get the “Too many connections” error when you to try to connect to your MySQL server. This means all available connections are used by some other.
Usually MySQL permits one extra connection along with number of the max_connections limit,And that extra connection is reserved for the database user having SUPER privilege in order to resolve mysql connection Issues. Normally we give privilege to the administrator user to normal users.
It depends on the size of RAM available and memory usage for each connection. Increasing max_connections value increases the number of file descriptors that mysqld requires
There is no hard limit to setting up maximum max_connections value. So, you have to choose max_connections wisely as per your workload, number of simultaneous connections to MySQL server etc.
On systems with small RAM or with a hard number of connections control on the application side, we can use small max_connections values like 100-300. Systems with 16G RAM 0r 32gb Ram max_connections=1000 or above is a good idea, while on some systems we can see up to 8k max connections, but such systems usually became down in case of heavy load .