Linux to modify the maximum number of concurrent connections MySQL

Source: Internet
Author: User

The first step is to see the maximum number of connections under current MySQL

The code is as follows Copy Code
[Root@localhost ~]#/usr/local/mysql/bin/mysqladmin-uroot-ppassword variables |grep max_connections

(Note that root is replaced with your database, but the general default is Root,password is the database password,) Enter the above command will display the following information, this is the maximum number of connections is 100

The code is as follows Copy Code
| max_connections | 100//default is 100

Part II, modify the maximum number of connections to 200

The code is as follows Copy Code

[Root@localhost ~]# nano/etc/my.cnf

Enter the contents of the My.cnf file after entering the above command and add the following line of code

The code is as follows Copy Code

max_connections=200

Use up and down arrows to move the cursor, input and then press Ctrl+o after the key to save, save the time to press ENTER again to determine, this place is also I began not to pay attention to the place, determined after pressing ctrl+x key to exit back to the command line

The last step is to restart MySQL.

The code is as follows Copy Code

[root@localhost ~]# Service mysqld restart//restart MySQL command


below is my own CentOS under the test pass

View the maximum number of connections to MySQL settings under the current system

The code is as follows Copy Code

1 [root@localhost ~]#/usr/bin/mysqladmin-uroot-p variables |grep max_connections

| max_connections | 100//default is 100

1 [root@localhost ~]# nano/etc/my.cnf

Edit my.cnf by adding in [Mysqld]:

1 set-variable=max_connections=1000

1 [root@localhost ~]# service mysqld restart//restart MySQL


Small hint, and not your MySQL concurrent number set the larger the better, we need to according to their own server and the status of the site to adjust the number of concurrent sites.

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.