文章收藏-FAQ 位置:电脑学习网

加大 mySQL 的最大连接数

    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 | 即新改动已经生效。

     [文章来源:“十万个为什么”电脑学习网]
     [网络地址:http://why100000.com]
     [版权声明:除本站部分特别声明禁止转载的专稿外,其他的文章可以自由转载,但请务必注明出处和原始作者。本站文章版权归文章原作者所有。如果本站转载的文章有版权问题请联系本站,我们会尽快予以更正。]
 

【字体:[大] [中] [小] 【加入收藏】 【发表评论】 【关闭本窗口】

Copyright © “十万个为什么”电脑学习网 2000-2007 陕ICP备06007929号
站务联系:MSN & Email:zhangking2008@gmail.com  QQ:9365822