max_connections refers to the maximum number of connections for the entire MySQL server;
max_user_connections refers to the maximum number of connections per database user, such as: Virtual host can use this parameter to control the maximum number of database connections per virtual host user;
MySQL server connection number is not to reach the maximum of 100%, or to specific problems specific analysis, the following on the MySQL server maximum connection number of reasonable settings for your reference.
We often meet the "mysql:error 1040:too Many connections" situation, one is that the traffic is really high, MySQL server can not resist, this time to consider increasing the spread from the server to read pressure, Another scenario is that the max_connections value in the MySQL configuration file is too small:
Mysql>Show variables like 'max_connections';+-----------------+-------+|Variable_name|Value|+-----------------+-------+|Max_connections| the |+-----------------+-------+
the maximum number of connections for this MySQL server is 256, then query the maximum number of connections the server responds to:
MySQL>like'max_used_connections';
The maximum number of connections the MySQL server responds to is 245, does not reach the maximum number of server connections 256, should not appear 1040 error, the more ideal setting is:
/ * - % - %
The number of response connections accounted for about 85% of the maximum number of connections, if the ratio is found below 10%, MySQL server connection is set too high.
Reasonable setup of max_connections and max_user_connections and MySQL server maximum connection number in MySQL