$ Mysql-uroot
Error 1040 (00000): Too connector connections
The above error is probably encountered by many people. aurimas mikalauskas has mentioned a solution in the MySQL performance blog (with caution in the production environment ):
$ GDB-p $ (cat data/mysql_sandbox5087.pid )\
-Ex "set max_connections = 5000"-Batch
The above mentioned is only a fire-fighting method. MySQL provides another method to avoid the above problems to a certain extent.
MySQL provides the max_connections parameter to control the maximum number of connections, which includes the number of connections of all users. MySQL also provides another parameter max_user_connections to control the maximum number of connections of a user. For example, if you set this parameter to 50, you can create up to 50 connections for any user (including the Super User.
Therefore, we can formulate the following policy: If MySQL has three users (excluding root), set max_user_connections to 300 and max_connections to 1000. Configuration file:
Max_connections = 1000
Max_user_connection= 300
Because there are only three users and the maximum number of connections for a single user is 300, there are only 900 connections at most normally, and 100 additional connections will always be used by the root user.