谁可以一步一步教我解决MySQL Server Error:Too many connections ( 1040 )的问题?

来源:百度知道 编辑:UC知道 时间:2024/05/19 17:17:56
我不会修改这种文件,什么都不会,谁可以一步一步的叫我怎么弄?
谢谢了,我访问论坛时出现了:

Connect(0) to MySQL failed

The URL Is:
http://www.mingdowbar.com/bbs/index.php?

MySQL Server Error:
Too many connections ( 1040 )

You Can Get Help In:
http://www.phpwind.net
怎么办,救救我!
在网上查到了相关的方法:
从官方文档知道linux上面编译安装的mysql默认的连接为100个,这样对于网站的需求来说是远远不够的。
文档:http://dev.mysql.com/doc/refman/5.0/en/too-many-connections.html
If you get a Too many connections error when you try to connect to the mysqld server, this means that all available connections are in use by other clients.

The number of connections allowed is controlled by the max_connections system variable

加大MySql的最大连接数

mysql的最大连接数默认是100, 这个数值对于并发连接很多的数据库应用是远远不够的,当连接请求大于默认连接数后,就会出现无法连接数据库的错误,因此我们需要把它适当调大一些, 有两种办法可以修改最大连接数,一种是修改safe_mysqld,另一种是直接修改原代码并重新编译。下面我们就分别介绍这两种方法:
1.修改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 $p