Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ Easily solve the MySQL database connection error too many     - Update GAMIT10.6 command (Linux)

- To remove those IP is prohibited Fail2ban on CentOS 6/7 (Server)

- How to configure chroot environment in Ubuntu 14.04 (Linux)

- WebLogic administrator account and reset the password (Database)

- Redis Design and Implementation study notes (Database)

- Windows Desktop use VNC remote connect Linux (Linux)

- Linux iptables firewall settings whitelist (RHEL 6 and CentOS 7) (Linux)

- How to create a someone project on github (Linux)

- Struts2 Result Types (Programming)

- Using Java program determines whether it is a leap year (Programming)

- Mount NFS network file system (Linux)

- How to upgrade Docker 1.6 on Fedora / CentOS (Server)

- Start Linux ISO image directly from the hard disk (Linux)

- Build RubyMine + Ruby On Rails + MySQL development environment under Windows (Server)

- Install Linux Mint 17: 20 things to do (Linux)

- Linux package management operations Basic entry (Linux)

- Linux operating system security settings initial understanding (Linux)

- Nginx DHCP TFTP Kickstart set up automatic installation system (Server)

- ASM required disk format process in Solaris platforms (Linux)

- Linux Apache server security (Linux)

 
         
  Easily solve the MySQL database connection error too many
     
  Add Date : 2018-11-21      
         
         
         
  1, MySQL database system to allow the maximum number of connections max_connections. This parameter can be set. If not set, the default is 100. The maximum is 16384.

2, the current database connection threads threads_connected. This is a dynamic change.

View max_connections, max_connections approach see below.

If when threads_connected == max_connections, the database system can not provide more connections, and then, if the program would like to create a new connection threads, the database system will be rejected if the program did not do much error handling, there will be similar strong altar of error messages.

Because creating and destroying database connection resources, will consume system. And in order to avoid too many open simultaneously at the same time the connection thread, now generally use the so-called programming database connection pool technology.

But the database connection pool, and can not avoid procedural errors caused the connection resource depletion.

This usually occurs in the program failed to release the database connection resources or other causes database connection resources can not be released, but it is estimated that this low intensity system altar programming errors do not occur.

Easy way to check the error is in strong altar refresh the page constantly monitors the changes threads_connected. If max_connections large enough, increasing the value and threads_connected even reach max_connections, so, you should check the program. Of course, if the maximum number of threads connecting a database connection pool, threads_connected growth to the database connection pool use, no longer increase.

Strong altar from the situation of error, the more likely is the database system could not be properly configured. Ask the following piece of advice. for reference

Let your engineers to MySQL's maximum allowable number of connections from the default of 100 tune into 32000. This is not the old problem of excessive connected.

View max_connections

Enter MySQL, use the command:

show variables

View database maximum number of connections to the values:

max_connections

View threads_connected

Enter MySQL, use the command:

show status

View the current activity variable values ​​connecting thread:

threads_connected

Setting max_connections

Approach is set in the my.cnf file, add the following last red line:

[Mysqld]
port = 3306
# Socket = MySQL
skip-locking
set-variable = key_buffer = 16K
set-variable = max_allowed_packet = 1M
set-variable = thread_stack = 64K
set-variable = table_cache = 4
set-variable = sort_buffer = 64K
set-variable = net_buffer_length = 2K
set-variable = max_connections = 32000

After modification, you can restart the MySQL. Of course, in order to ensure the settings are correct, we should look max_connections.

note:

1, although the writing here 32,000. But the maximum number of connections the actual MySQL server allows 16384;

2, in addition to max_connections, the above-mentioned other configuration should be based on their need to configure your system, not rigidly stick to;

3, add the maximum allowable number of connections to the system consumes little increase.

4, if you use the my.ini for mysql configuration file settings similar, but set the format to make some modifications
     
         
         
         
  More:      
 
- Linux group account deletion, and other related operations (Linux)
- Hadoop 2.6.0 standalone configuration and pseudo-distributed configuration under Ubuntu 14.04 (Server)
- To learn from scratch OpenWrt perfect tutorial (Linux)
- Installation and Configuration Tomcat environment CentOS 6.6 (Server)
- MySQL main and backup replication structures (using mysqld_multi) (Database)
- RedHat Redis Linux installation (Database)
- Getting the Linux shell expr use (Programming)
- HTTP and FTP TCP-FLOOD CC Attacks Analysis and Prevention solutions under CentOS 6.5 (Linux)
- Oracle bdump file soaring (Database)
- Ubuntu 14.10 installation GNOME 3.14 (Linux)
- VMware Workstation + Ubuntu 10.04 Download the Android 2.2 source code (Linux)
- How to use the ps command to monitor progress in the implementation of Linux commands (Linux)
- Install minimize RHEL / CentOS 7 things to do (Linux)
- JITwatch installation under Linux (Linux)
- MySQL IO SSD attempt at optimization (Database)
- Windows 7 hard disk to install Ubuntu 15.04 (Linux)
- Linux bash: scp: command not found the problem (Linux)
- AngularJS achieve picture upload feature (Programming)
- RPM package management tools under Linux (Linux)
- Change the kernel boot sequence after CentOS 7 kernel upgrade (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.