Example of modifying MySQL default maximum connections

Source: Internet
Author: User

MySQL database default maximum connection data is 100, if we want to modify can take advantage of two ways, one is the set GLOBAL max_connections command execution, the other is to open the MySQL profile My.ini or my.cnf lookup max_ Connections=, let's take a look at the following.

View MySQL Maximum connection data

The code is as follows

Show variables like '%max_connections% '

To modify the method:

Into the MySQL terminal,

The code is as follows

MySQL > Set GLOBAL max_connections=1000;
MYSQ > Show variables like '%max_connections% ';

Of course, you can also directly modify the MySQL configuration file. 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.

Note: The maximum number of connections allowed by the MySQL server is 16384

Another way to do it in a Linux system

The manual compilation version of the MySQL 5.0.33 below CentOS 4.4 illustrates:

The code is as follows

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:

The code is as follows

-O max_connections=1500

The specific point is the following location:

The code is as follows

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.

  code is as follows &nbs P;

# service mysqld restart

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

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.