MySQL database installation is complete, the default maximum number of connections is 100, the general flow slightly larger forum or Web site This connection number is far from enough, increase the default number of MySQL connection methods have two
Method One: Enter the MySQL installation directory to open the MySQL profile My.ini or my.cnf find max_connections=100 Modify for max_connections=1000 service to restart MySQL
Method Two: MySQL maximum number of connections default is 100 client login: Mysql-uusername-ppassword
Sets the new maximum number of connections to 200:mysql> set GLOBAL max_connections=200
Displays the currently running query:mysql> show processlist
Display current status:mysql> show status
Exit Client:mysql> Exit
View the current maximum number of connections: Mysqladmin-uusername-ppassword variables
Method Three: CentOS 4.4 under the MySQL 5.0.33 manually compiled version as an example to illustrate:
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:
-O max_connections=1500
The specific point is the following location:
In the Red Word special Description:
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
Enter the password for the root database account to see
Max_connections 1500 that the new changes have taken effect.
There is another way,
To modify the original code:
Unlock the original MySQL code, into the inside of the SQL directory modification mysqld.cc found 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 to exit, and then./configure Make;make Install can achieve the same effect.