Setting the maximum number of connections for mysql after the MYSQL database is installed, the default maximum number of connections is 100. Generally, the number of connections for forums or websites with a slightly larger traffic 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 search for max_connections = 100 and change it to max_connections = 1000 to restart MYSQL in the service to www.2cto.com.
Method 2: the maximum number of connections in MySQL is 100 by default. log on to the client: mysql-uusername-ppassword. set the maximum number of connections to 200: mysql> set GLOBAL max_connections = 200 to display the currently running Query: mysql> show processlist: mysql> show status exit client: mysql> exit to view the current maximum number of connections: mysqladmin-uusername-ppassword variables method 3: take mysql 5.0.33 in centos 4.4 as an example: vi/usr/local/mysql/bin/mysqld_safe find safe_mysqld to edit it and find the two lines started by mysqld, add the parameter-O max_connections = 1500 www.2cto.com. The following position: The red letter is used for special explanation: then $ defaults $ 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 enter the password of the root database account and you can see that max_connections 1500 indicates that the new change has taken effect. Another way is to modify the original code at www.2cto.com: unbind the original MySQL code and go to the SQL directory to modify mysqld. find The following line for cc: {"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: {"max_connections", OPT_MAX_CONNECTIONS, "The number of simultaneous clients allowed. ", (gptr *) & max_connections, (gptr *) & max_conne Functions, 0, GET_ULONG, REQUIRED_ARG, 1500, 1, 16384, 0, 1, 0}, save the disk and exit./configure; make install can achieve the same effect. Author XL. Liang