Default number of MySQL 5.0 connections under Mac OS x

Source: Internet
Author: User
Tags mysql code

This period of time MySQL on the development process crashes 2 times, has not found the reason, because the use of the MacBook is fully equipped with memory, top view also no exception. SAR is also normal. The MySQL log also has no valuable information. This article explains the workaround: Modify the default number of MySQL 5.0 connections under Mac OS x.

This time the server crashes 2 times, has not found the reason, today to see the forum sent the wrong message, think of may be the default number of MySQL connection problems, a check sure enough, God, the default connection number is only 100, how enough ah, on the internet for half a day of information, There are said to modify the MY.CNF, there are said to modify Safe_mysqld, tried, the former useless,

The latter file could not be found: The original version is different from the current version.

Anyway, I've compiled the version of the MySQL 5.0.7 manually under Mac OS X 10.5.6 for example:

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.

Related Article

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.