The solution is to modify/etc/mysql/my. cnf and add the following line:
Set-variable = max_connections = 500
Or add the parameter max_connections = 500 to the startup command.
It is to modify the maximum number of connections, and then restart mysql. The default number of connections is 100, which is too small, so the problem is prone to errors.
The following is a description of the mysql.com Website:
If you get a Too response connections error when you try to connect to the mysqld server, this means that all available connections are in use by other clients.
The number of connections allowed is controlled by the max_connections system variable. Its default value is 100. If you need to support more connections, you should restart mysqld with a larger value for this variable.
Mysqld actually allows max_connections + 1 clients to connect. the extra connection is reserved for use by accounts that have the SUPER privilege. by granting the SUPER privilege to administrators and not to normal users (who shocould not need it ), an administrator can connect to the server and use show processlist to diagnose problems even if the maximum number of unprivileged clients are connected. see Section 13.5.4.19, "show processlist Syntax ".
The maximum number of connections MySQL can support depends on the quality of the thread library on a given platform. linux or Solaris shocould be able to support 500-1000 simultaneous connections, depending on how much RAM you have and what your clients are doing. static Linux binaries provided by MySQL AB can support up to 4000 connections.
1. It may be a problem with mysql's max connections settings.
2. It may be multiple insert operations. The update operation does not close the session. You need to configure transaction support in spring.
Solution:
1. Reduce the time-out time of the session in tomcat to 20 (not required)
2. Provides transaction support for database insert or update operations with large processing capacity.
========================================================
The following is a solution:
Com. mysql. jdbc. exceptions. jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server :"Too connector connections"
Cause:
BecauseMy. iniThe number of concurrent connections set in is too small or the system is busy.
Solution:
Open the MYSQL installation directory, open MY. INI, and find max_connections (in approximately 93rd rows). The default value is 100, which is generally set to 500 ~ 1000 is more suitable. Restart mysql and solve the 1040 error.
Max_connections = 1000
MYSQL must be restarted to take effect.
CMD->
Net stop mysql
Net start mysql
Mysql cannot be started after innodb_log_file_size is changed.
Innodb_buffer_pool_size = 768 M
Innodb_log_file_size = 256 M
Innodb_log_buffer_size = 8 M
Innodb_additional_mem_pool_size = 4 M
Innodb_flush_log_at_trx_commit = 0
Innodb_thread_concurrency = 20
The above is a preliminary optimization of the innodb engine. It was found that there was a problem when innodb_log_file_size = 256M was updated. If this is added, the engine cannot be started,
Later, I realized thatSTOP Service firstAnd then delete the original file .........
Open/MySQL Server 5.5/data
Delete ib_logfile0, ib_logfile1 ...... ib_logfilen
Enable option again and start successfully.