我电脑这是怎么了!!!!!!!!!!

来源:百度知道 编辑:UC知道 时间:2024/06/22 12:40:05
我在进某些网站的时候会显示出来
Too many connections
字样
请问怎么解决

怎样增加mysql的max_connections,mysql连接数默认是100, 这个数值对于并发连接很多的数据库应用是不够的,可是怎样把它适当调大呢?

找到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

这个办法有问题,设置后不起作用,下面的方法可以:

找到my.ini(在windows\下,没有就在mysql\下找)

打开它

[mysqld]
set-variable = max_connections=16384