Mysql error Too many connections solution _mysql

Source: Internet
Author: User

Mysql Error prompted too many connections, recently encountered this error, after the internet to solve the data, here record, to help needy friends,

The workaround is to modify the/ETC/MYSQL/MY.CNF and add the following line:

Set-variable = max_connections=500

Or add parameters to the startup command max_connections=500

is to modify the maximum number of connections, and then restart MySQL. The default number of connections is 100, too few, so it is easy to appear as the title error.

The following is a description of the mysql.com Web site:

If you have a Too many connections error when you try to connect to the MYSQLD server, this means and all available Connec tions are in with the other clients.

The number of connections allowed is controlled by the max_connections system variable. Its default value is 100. If you are need to support more connections, you are should restart mysqld with a larger value for this variable.

Mysqld actually allows max_connections+1 clients to connect. The extra connection is reserved to 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 C Onnect to the "server and use" processlist to diagnose problems even if maximum number of unprivileged clients Connected. 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 is able to support 500-1000 simultaneous connections, depending on how much RAM for you have and what Your clients are doing. Static Linux binaries provided by the MySQL AB can support up to 4000 connections.

1. Probably the problem of MySQL max connections setup

2. It is possible that multiple insert,update operations do not close session, and need to configure transaction support in spring.

Solve:

1. Reduce the time-out time of the session in Tomcat to 20, (not required)

2. Provide transaction support for the operation of database insert or update operations with large amount of processing.

=======================================

Here's the solution:

Com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:Data Source rejected establishment of Connection, message from server: "Too many connections"

Reason:

Because the number of concurrent connections in the My.ini in your MySQL installation directory is too low or the system is busy causing the number of connections to be filled up

Solution Method:

Open the MySQL installation directory to open My.ini find Max_connections (on the 93rd line) by default is 1001-like settings to 500~1000 more appropriate, restart MySQL, so 1040 errors to solve it.

max_connections=1000

Be sure to restart MySQL to take effect

Cmd->

net stop MySQL

net start MySQL

About the problem of not starting MySQL after changing 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 initial optimization of the InnoDB engine, found that the update innodb_log_file_size=256m when there is a problem, as long as the addition of this can not start,

Later know that the original to stop service first, and then delete the original file ...

Open/mysql Server 5.5/data

Delete Ib_logfile0, Ib_logfile1........ib_logfilen

Open the option again and start successfully.

Thank you for reading, I hope to help you, thank you for your support for this site!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.