The following article describes how to modify the default connections of MySQL 5.0 in Linux, if you are interested in the actual operation steps for modifying the default connections of MySQL 5.0 in Linux, you can click the following article.
During this time, the server crashed twice and no reason was found. Today I saw an error message email sent from the Forum, remembering the problem that may be caused by the default connections of MySQL (the best combination with PHP, check it out. my God, the default number of connections is only 100. How can this problem be solved? I found some information on the Internet for a long time and said I had to modify my account. for cnf, it is said that modifying safe_MySQL (the best combination with PHP) d is useless,
The latter file cannot be found: the original version is different from the current version.
Let's get down to the truth. Take MySQL (the best combination with PHP) in centos 4.4 5.0.33 for manual compilation as an example:
Vi/usr/local/MySQL (the best combination with PHP)/bin/MySQL (the best combination with PHP) d_safe
Find safe_MySQL (the best combination with PHP) d and edit it. Find the two lines started in MySQL 5.0 and add the following parameters:
-O max_connections = 1500
The specific point is the following position:
Note in Red:
- Then $ NOHUP_NICENESS $ ledir/$ MySQL (best combination with PHP) D
$ 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/$ MySQL (best combination with PHP) D
$ 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 MySQL (the best combination with PHP) d restart
- #/Usr/local/MySQL (the best combination with PHP)/bin/MySQL (the best combination with PHP) admin-uroot-p variables
Enter the password of the root database account.
Max_connections 1500 indicates that the new change has taken effect.
There is another method,
Modify the original code:
Unlock the original code of MySQL (the best combination with PHP) and go to the SQL directory to modify MySQL 5.0.cc and 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.
The above content is an introduction to modifying the default number of connections of MySQL 5.0 in Linux. I hope you will find some gains.