The workaround 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 few, so it is easy to get the same error. Here are the instructions for mysql.com website: If you get a Too many 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 should 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 should 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 could be an issue with MySQL's Max Connections settings 2. It may be multiple inserts, and the update operation does not close the session, and you need to configure transaction support in spring. Resolution: 1. Modify the time-out time of the session in tomcat to 20, (not mandatory) 2. Provide transaction support for large processing volume of database insert or update operations.
=======================================
Here's the solution:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections"
Cause: Because your mysql installation directorymy.iniThe number of concurrent connections set in the system is too small or the system is busy, causing the number of connections to be full Solution: Open the MYSQL installation directory and open MY.INI find the max_connections (on about line 93) the default is 100 Generally it is more appropriate to set it to 500~1000, restart mysql, so that the 1040 error will be solved.
max_connections=1000
Be sure to restart MYSQL for it to take effect
CMD->
net stop mysql
net start mysql
Regarding the issue of not being able to start mysql after changing the innodb_log_file_size
innodb_buffer_pool_size=768M innodb_log_file_size=256M innodb_log_buffer_size=8M innodb_additional_mem_pool_size=4M innodb_flush_log_at_trx_commit=0 innodb_thread_concurrency=20 The above is the preliminary optimization of the innodb engine, it was found that there was a problem when updating innodb_log_file_size=256M, as long as this was added, it could not start.
Later, I found out that I had to STOP the service first, and then delete the original file......... Open /MySQL Server 5.5/data
Delete ib_logfile0, ib_logfile1........ ib_logfilen Then open the option and start it successfully.
|