Data source rejected establishment of connection message from server: “Too many connections”; Database error solution

Article Directory

Problem Description

The situation when the error was reported: When the error was reported, I used Dubbo in the microservice project for management, and then started several projects at the same time to perform database operations, and an error occurred. However, when executing a single project module, database operations can be performed.
Specifically I forgot to take a screenshot of the error message. You can see the error message in the link below to describe the solution to the MYSQL Too many connections error.

This problem can also be seen from the literal meaning that the number of database connections exceeds the limit, so how to solve it?
Most of the current project development will use JDBC connection pools, such as c3p0, etc., so it is conceivable that the problem of the number of database connections is nothing more than related to the settings of the data itself and the parameter settings of the connection pool.
My here is related to the configuration of the database itself, let me talk about my solution

Solution

Reason:
Because the number of concurrent connections set in my.ini in your mysql installation directory is too small or the system is busy, the number of connections is full

Find the configuration file in the Android directory of MySQL my.ini,
insert image description here
then open it, and find the parameter in it max_connections(the meaning of this parameter is the maximum number of MySQL connections currently configured), the value I configured during installation is max_connections=20
relatively small, and it is said that the default is 100 , I don’t know when I changed it to 20, and then follow the boss’s operation to change the configuration to 1000
(the default is 100, and it’s more appropriate to set it to 500-1000).
insert image description here
Remember to save after changing, and then restart the MySQL service
insert image description here
to add :
The maximum number of connections supported by the MySQL server is limited, because each connection and the operation of opening the first table consumes server memory. The ideal state is that when a MySQL client connection completes its work, it will automatically disconnect and release the memory. If Your website has a large number of MySQL connection requests. After completing the SQL execution tasks, these connections are idle and do nothing, occupying memory resources in vain. If these connections accumulate, MySQL will exceed the maximum number of connections, making it impossible to create a new MySQL connection, it may lead to "Too many connections" error.

Other reference blog posts:
Solve the connection problem of Data source rejected establishment of connection, message from server: "Too many connections"

Guess you like

Origin blog.csdn.net/mfysss/article/details/130234334