After MYSQL database installation is complete, the default maximum number of connections is 100, the general flow slightly larger forums or websites this connection is not enough, increase the default number of MYSQL connections there are two
Method One: Enter the MYSQL installation directory Open MYSQL configuration file my.ini or my.cnf Find max_connections = 100 Modify max_connections = 1000 MYSQL Based restart the service
Method Two: The maximum number of MySQL connections is 100 Client login: mysql-uusername-ppassword
Set the new maximum number of connections to 200: mysql> set GLOBAL max_connections = 200
Display currently running Query: mysql> show processlist
Show the current status: mysql> show status
Exit the client: mysql> exit
Check the current maximum number of connections: mysqladmin-uusername-ppassword variables
Method three: CentOS 4.4 mysql 5.0.33 manual compiled version as an example:
vi / usr / local / mysql / bin / mysqld_safe
Find safe_mysqld edit it, find the mysqld start two lines, add the parameters in the back:
-O max_connections = 1500
The specific point is the following location:
Special note in red
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 of the root database account can be seen
max_connections 1500 That the new changes have taken effect.
There is also a way,
Modify the original code:
Unlock the MySQL source code, enter the sql directory inside Modify mysqld.cc 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, then. / Configure; make; make install can get the same effect.