Example of modifying the default maximum connections of mysql

Source: Internet
Author: User

The default maximum connection data of the mysql database is 100. If you want to modify the data, you can use either the set GLOBAL max_connections command or the MySQL configuration file my. ini or my. cnf search for max_connections = and modify it. Let's take a look.

View mysql maximum connection data

The Code is as follows: Copy code

Show variables like '% max_connections %'

Modification method:

Enter the mysql terminal,

The Code is as follows: Copy code

Mysql> set GLOBAL max_connections = 1000;
Mysq> show variables like '% max_connections % ';

Of course, you can also directly modify the mysql configuration file. Go to the MySQL installation directory and open the MySQL configuration file my. ini or my. cnf to find max_connections = 100 and change it to max_connections = 1000 to restart MySQL.
Note: The maximum number of connections allowed by the MySQL server is 16384.


Another method in linux


Take mysql 5.0.33 in centos 4.4 as an example:

The Code is as follows: Copy code

Vi/usr/local/mysql/bin/mysqld_safe

Find safe_mysqld and edit it. Find the two lines started by mysqld and add the following parameters:

The Code is as follows: Copy code

-O max_connections = 1500

The specific point is the following position:

The Code is as follows: Copy code

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.

The Code is as follows: Copy code

# Service mysqld restart

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

Enter the password of the root database account.

Max_connections 1500 indicates that the new change has taken effect.

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.