CentOS Modify MySQL Database maximum concurrent connection number script

Source: Internet
Author: User

CentOS under test pass

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

The code is as follows Copy Code

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

| max_connections | 100//default is 100

or view directly in MySQL command mode

The code is as follows Copy Code

Mysql> Show variables like ' max_connections ';

This command will result in output similar to the following:

+-----------------+-------+
| variable_name | Value |
+-----------------+-------+
| max_connections | 2000 |
+-----------------+-------+
1 row in Set (0.00 sec)

Start editing the my.cnf file now

The code is as follows Copy Code

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

Edit my.cnf by adding in [Mysqld]:

set-variable=max_connections=1000

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


Another method can be directly in the command mode


The maximum number of connections for MySQL default is 100 client login: Mysql-uusername-ppassword

Set the new maximum number of connections to 200:mysql> set GLOBAL max_connections=200;

Displays the currently running query:mysql> show processlist;

Display current status:mysql> show status;

Exit Client:mysql> Exit

Summarize

Method Two to restart the server or MySQL to restore the previous state, the method is a long time to enter into effect oh.

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.