Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 39.3Mb
PDF (A4) - 39.3Mb
PDF (RPM) - 38.6Mb
HTML Download (TGZ) - 11.1Mb
HTML Download (Zip) - 11.1Mb
HTML Download (RPM) - 9.8Mb
Man Pages (TGZ) - 212.5Kb
Man Pages (Zip) - 321.6Kb
Info (Gzip) - 3.6Mb
Info (Zip) - 3.6Mb
Excerpts from this Manual

B.5.2.6 Too many connections

If clients encounter Too many connections errors when attempting to connect to the mysqld server, all available connections are in use by other clients.

The permitted number of connections is controlled by the max_connections system variable. The default value is 151 to improve performance when MySQL is used with the Apache Web server. To support more connections, set max_connections to a larger value.

mysqld actually permits max_connections + 1 client connections. The extra connection is reserved for use by accounts that have the SUPER privilege. By granting the privilege to administrators and not to normal users (who should not need it), an administrator who also has the PROCESS privilege can connect to the server and use SHOW PROCESSLIST to diagnose problems even if the maximum number of unprivileged clients are connected. See Section 13.7.5.29, “SHOW PROCESSLIST Syntax”.

For more information about how the server handles client connections, see Section 8.12.5.1, “How MySQL Handles Client Connections”.


User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
  Posted by oscar duron on November 27, 2014
Beware of mysql max connections on some hosting server providers who do not mention it in contract but they set max connections = 1 and if you need more you have to pay for premium services.
  Posted by rathish kumar on July 24, 2017
You can login as root and increase the max_connections variable value. This can be done by using following command:

SET GLOBAL max_connections = 500;

This does not require server restart, however, it will last only till next restart. In order to make it permanent, you have to set it at the configuration file as follows:

vi /etc/my.cnf
[mysqld]
max_connections=500;

Check this article for complete details http://www.rathishkumar.in/2017/07/how-to-fix-mysql-too-many-connections.html

Now restart the server to apply changes. For each new connections, MySQL pre-allocate the memory. Make sure, you have enough resources on server before increasing into larger values.
Sign Up Login You must be logged in to post a comment.