Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set the maximum number of connections in mysql

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces how to set the maximum number of connections in mysql. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

The method of setting the maximum number of connections in mysql

After the MYSQL database installation is completed, the default maximum number of connections is 100. generally, the number of connections to a slightly larger traffic or website is far from enough. There are two ways to increase the default number of MYSQL connections.

Method 1: go to the MYSQL installation directory and open the MYSQL configuration file my.ini or my.cnf to find max_connections=100 and modify it to restart MYSQL in the max_connections=1000 service to www.2cto.com.

Method 2: the maximum number of connections for MySQL is 100 client login by default: 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

Show current status: mysql > show status

Exit the client: mysql > exit

View the current maximum number of connections: mysqladmin-uusername-ppassword variables

Method 3: take the manual compiled version of mysql 5.0.33 below centos 4.4 as an example:

Vi / usr/local/mysql/bin/mysqld_safe

Find safe_mysqld and edit it, find the two lines where mysqld starts, and add parameters at the end:

-O max_connections=1500 www.2cto.com

Specifically, it is the following location:

To specify in the scarlet letter:

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.

# service mysqld restart

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

After entering the password of the root account, you can see

Max_connections 1500 means that the new changes have come into effect.

There's another way, www.2cto.com.

Modify the original code:

Unlock the original code of MySQL, enter the sql directory inside and modify d.cc to find the following line:

{"max_connections", OPT_MAX_CONNECTIONS

"The number of simultaneous clients allowed." (gptr*) & max_connections

(gptr*) & max_connections, 0, GET_ULONG, REQUIRED_ARG, 100,1, 16384, 0,1

0}

Change it to:

{"max_connections", OPT_MAX_CONNECTIONS

"The number of simultaneous clients allowed." (gptr*) & max_connections

(gptr*) & max_connections, 0, GET_ULONG, REQUIRED_ARG, 1500, 1, 16384, 0, 1

0}

Save and exit, and then. / configure; make;make install can get the same effect.

On how to set the maximum number of connections in mysql to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report