学习网考试学习资料

Gzu521.com

加大MySql的最大连接数

MySQL教程   点击:次   发布时间:2005-11-8   【字体: 】   来源:Gzu521.com
贵 州 学 习 网

max queries per hour --- 每小时的最大查询次数
max updates per hour  --- 每小时的最大更新次数
max connections per hour --- 每小时最多连接次数

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

在unix/LINUX下:
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行

责任编辑:gzu521

网络编程分类
ASP教程
.Net教程
Java教程
PHP教程
数据库基础
ACCESS教程
SQL Server教程
MySQL教程
Oracle教程
分类推荐信息
更多...
大类最新文章
更多...