How to modify the MySQL connection number overrun method

Source: Internet
Author: User
Tags reset

The steps are as follows (both Windows and Linux platforms apply):

A, client login mysql, enter user name and password

B, set the new maximum number of connections at the MySQL command prompt to 500:mysql> set GLOBAL max_connections=500

C, display the currently running query:mysql> show processlist

D, display the current mysql system parameter status:mysql> show status

E, exit client:mysql> exit

Viewing the current maximum number of connections only needs to be seen by executing the following command in the Mysqladmin directory: Mysqladmin-username-password variables |find "Max_con". You can also use the MySQL parameter list inside phpMyAdmin to see the maximum number of connections.

Disadvantage: Restart the computer or MySQL after the maximum number of connections will be reset to the original value, need to reset.

2, modify My.ini or My.cnf file method (need to restart MySQL), you can refer to the same directory under the MySQL configuration template (small memory, large memory, super large memory)

CentOS 4.4 The following MySQL 5.0.33 manually compiled version as an example to illustrate:

Vi/usr/local/mysql/bin/mysqld_safe

Find Safe_mysqld edit it, find the two lines where the mysqld starts, and then add the arguments back:

-O max_connections=1500

The specific point is the following location:

In the Red Word special Description:

Then $NOHUP _niceness $ledir/$MYSQLD

$defaults--basedir= $MY _basedir_version

--datadir= $DATADIR $USER _option

--pid-file= $pid _file

--skip-external-locking

-O max_connections=1500

>> $err _log 2>&1 Else

Eval "$NOHUP _niceness $ledir/$MYSQLD

$defaults--basedir= $MY _basedir_version

--datadir= $DATADIR $USER _option

--pid-file= $pid _file

--skip-external-locking $args

-O max_connections=1500 >>

$err _log 2>&1 "

Save.

# Service Mysqld Restart

#/usr/local/mysql/bin/mysqladmin-uroot-p variables

Enter the password for the root database account to see

Max_connections 1500 that the new changes have taken effect

Under Windows system:

Enter the MySQL installation directory to open the MySQL profile My.ini or my.cnf find max_connections=100 modify the max_connections=1000 service to restart MySQL

Under the Linux console:

Open my.cnf File: vi/etc/my.cnf

Modify the value of max_connections under [mysqld] to a set value.

Days Note: You may have installed MySQL source and version of different (Windows Mysql+iis and php+apache+mysql Suite final installation results are almost different), My.ini file path may be a little differently, My.ini may also retain a copy of the C: Windows directory needs to be modified at the same time.

Note: Max_connections Open data on a Windows system cannot be larger than the number of Windows system files opened.

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.