下一篇 » « 上一篇

加大MySql的最大连接数

作者:    时间:2008-01-22    来源:    点击:1386    本文共1篇文章 字体:[ ]

加大MySql的最大连接数

MAX QUERIES PER HOUR --- 每小时的最大查询次数
MAX UPDATES PER HOUR  --- 每小时的最大更新次数
MAX CONNECTIONS PER HOUR --- 每小时最多连接次数 php学习之家

在Win下可以修改my.ini:
4.0及一下版本在[mysqld]所属下插入
set-variable=max_connections=1000(或更多) 即可。
4.1以上修改max_connections的属性
max_connections=1000(或更多) 即可。

php学习之家

在Unix/Linux下:
mysql的最大连接数默认是100, 这个数值对于并发连接很多的数据库应用是远远不够的,可以把它适当调大

php学习之家

whereis safe_mysqld 本文来自 www.444p.com

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

www.444p.com

-O max_connections=1000

php学习之家

例如
--- 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

www.444p.com

然后关闭mysql重启它,用
/mysqladmin所在路径/mysqladmin -uroot -p variables
输入root数据库账号的密码后可看到
| max_connections | 1000 |
即新改动已经生效。 www.444p.com版权所有

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

www.444p.com

责任编辑:semirock
发表评论
密码: (游客不需要密码)
记住我【Alt+S 或 Ctrl+Enter 快速提交】

搜索工具


《PHP与MYsql》点击排行