Q: How to solve the MySQL connection too many errors?
Answer: The system cannot connect the database, the key depends on two data:
1, the database system allows the maximum number of max_connections to connect. This parameter can be set. If not set, the default is 100. The maximum is 16384.
2, the database current connection thread number threads_connected. This is a dynamic change.
See Max_connections, Max_connections of the way after.
If the threads_connected = = max_connections, the database system can not provide more connection number, at this time, if the program also want to create a new connection thread, the database system will reject, if the program did not do too much error handling, will appear similar to the strong altar of information.
Because the connection to the database is created and destroyed, the resources of the system are consumed. And to avoid the simultaneous opening of too many connection threads at the same time, programming is now generally using the so-called database connection pooling technology.
However, database connection pooling technology does not prevent program errors from depleting the connection resources.
This situation usually occurs when the program fails to release the database connection resources or other causes in time for the database connection resources to be released, but the high altar system does not expect this low-level programming error to occur.
The easy way to check this error is to constantly monitor threads_connected changes as you refresh the strong altar page. If the max_connections is large enough and the threads_connected value is increasing to max_connections, then the procedure should be checked. Of course, if you are using database connection pooling technology, threads_connected grows to the maximum number of connection threads in the database connection pool, no longer grows.
Judging from the strong altar, the larger possibility is that the database system could not be properly configured. Here are some suggestions. For reference
Ask your engineers to turn MySQL's maximum allowable number of connections from the default of 100 to 32000. This will not be the problem of too many connections.
View Max_connections
Go to MySQL and use the command:
show variables