During this time, the server crashed twice and no reason was found. I saw an error message email sent from the Forum today, remembering the problem that may be caused by the default connections of mysql, the default number of connections is only 100. How can this problem be solved? I found some information on the Internet for half a day and said I should modify my. for cnf, it is said to modify safe_mysqld and try it. The former is useless, and the latter file cannot be found. The original version is different from the current version.
To put it bluntly, I will take mysql 5.0.33 in centos 4.4 as an example:
Vi/usr/local/mysql/bin/mysqld_safe
Find safe_mysqld and edit it. Find the two lines started by mysqld and add the following parameters:
-O max_connections = 1500
The specific point is the following position:
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.
Max_connections 1500 indicates that the new change has taken effect.
Another method is as follows:
Modify the original code:
Unlock the original MySQL code and go to the SQL directory to 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:
{"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 the disk and exit./configure; make install to achieve the same effect.