Modify the default connections of MySQL 5.0 in Linux

Source: Internet
Author: User

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:

 
 
  1. 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.

 
 
  1. # Service MySQL (the best combination with PHP) d restart
  2. #/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:

 
 
  1. {"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:

 
 
  1. {"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.


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.