Summary of several methods to modify the maximum number of MySQL connections

Source: Internet
Author: User

After MySQL is installed, there are many parameters that need tuning. Almost all of the content involved in tuning can be set up in the My.cnf file. The number of MySQL connections is also one of the more important tuning parameters. MySQL's default maximum connection number is 100, for large load of concurrent requirements is not enough, then you can modify the MySQL maximum number of connections.

1, view the current MySQL maximum number of connections method:

Mysqladmin-uroot-ppassword Variables | grep max_connections
Or
Mysql> show GLOBAL VARIABLES WHERE variable_name= ' max_connections ';
Or
Mysql> show GLOBAL like '%conn% ';

I personally prefer to use the last method to view, because I always remember not full connections the word. Oh......

2, the modification method has

mysql> SET GLOBAL max_connections=1000;
Changes will take effect immediately, do not need to restart the MySQL service, but will fail after reboot.

Modify/ETC/MY.CNF,

Add under [mysqld]:

max_connections=1000

You will need to restart the MySQL service before you can make the changes again.

3: The modification method has

Client Login Mysql:mysql-uusername-ppassword

Set the new maximum number of MySQL connections for 1000:mysql> set GLOBAL max_connections=1000;

Displays the currently running query:mysql> show processlist;

Display current status:mysql> show status;

Exit client:mysql> exit;

View current maximum number of MySQL connections: Mysqladmin-uusername-ppassword variables;
The following two commands can be used to query the maximum number of connections and the number of connected connections:

Show variables like ' max_connections '; #查看最大连接数 (default 100).

Show global status like ' Xax_used_connections '; #查看最大使用量

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.