加大mysql的最大连接数

王朝mysql·作者佚名  2008-05-18
窄屏简体版  字體: |||超大  

mysql的最大连接数默认是100, 这个数值对于并发连接很多的数据库应用是远远不够的,

可以把它适当调大,

whereis safe_mysqld

找到safe_mysqld的位置,然后编辑它,找到mysqld启动的那两行,在后面加上参数

-O max_connections=1000

例如

--- safe_mysqld.orig Mon Sep 25 09:34:01 2000

+++ safe_mysqld Sun Sep 24 16:56:46 2000

@@ -109,10 +109,10 @@

if test "$#" -eq 0

then

nohup $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR

- --skip-locking >> $err_log 2>&1

+ --skip-locking -O max_connections=1000 >> $err_log 2>&1

else

nohup $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR

- --skip-locking "$@" >> $err_log 2>&1

+ --skip-locking "$@" -O max_connections=1000 >> $err_log 2>&1

fi

if test ! -f $pid_file # This is removed if normal shutdown

then

然后关闭mysql重启它,用

/mysqladmin所在路径/mysqladmin -uroot -p variables

输入root数据库账号的密码后可看到

| max_connections | 1000 |

即新改动已经生效。

注:

在mysql 4.07版本中,在safe_mysqld文件的第274和276行

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航