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

What are the ways for mysql to modify the maximum number of connections

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

Share

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

This article mainly explains "what are the methods for mysql to modify the maximum number of connections". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the methods for mysql to modify the maximum number of 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. Modify it to restart MYSQL in the max_connections=1000 service.

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 > setGLOBALmax_connections=200

Displays the currently running Query:mysql > showprocesslist

Show current status: mysql > showstatus

Exit the client: mysql > exit

View the current maximum number of connections: mysqladmin-uusername-ppasswordvariables

There are several common methods to modify the maximum number of connections in mysql

Method 3:

Take the manual compiled version of mysql5.0.33 under centos4.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:

-Omax_connections=1500

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

-Omax_connections=1500

> > $err_log2 > & 1else

Eval "$NOHUP_NICENESS$ledir/$MYSQLD

$defaults--basedir=$MY_BASEDIR_VERSION

-- datadir=$DATADIR$USER_OPTION

-- pid-file=$pid_file

-- skip-external-locking$args

-Omax_connections=1500 > >

$err_log2 > & 1 "

Save.

# servicemysqldrestart

# / usr/local/mysql/bin/mysqladmin-uroot-pvariables

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

Max_connections1500 means that the new changes have taken effect.

There's another way.

Modify the original code:

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

{"max_connections", OPT_MAX_CONNECTIONS

"Thenumberofsimultaneousclientsallowed." (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

"Thenumberofsimultaneousclientsallowed." (gptr*) & max_connections

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

0}

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

Thank you for your reading, the above is the content of "what is the method for mysql to modify the maximum number of connections". After the study of this article, I believe you have a deeper understanding of what the method of mysql to modify the maximum number of connections has, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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