Refer to the followingArticle
Http://www.mysqlperformanceblog.com/2010/03/23/too-many-connections-no-problem/
Conclusion:
(1) MySQL will leave a connection for the Super User by default. You can use this reserved connection to log on and increase the number of connections. However, if all the connected users have the super permission, the reserved connection does not exist. In this case, you can use the following command to set the number of connections: GDB-p $ (cat data/mysql_sandbox5087.pid)-Ex "set max_connections = 5000"-Batch
(2) wait_timout indicates the number of seconds that a connection will wait before it is closed. Before that, the connection is not closed and the status is sleep. Therefore, this value must be set to a suitable small value, which can make the Connection Recycled faster.
(3) set global max_connections = 1500 to increase the maximum number of connections
(4) set global max_user_connections = 300, which is any givenMySQLThe maximum number of concurrent connections allowed by the account can prevent a user from having too many connections to MySQL.
(5) interactive_timeout: the number of seconds waiting for activity before the server closes the interactive connection (interactive connection is similar to a session connecting to MySQL in MySQL management tools)