mysql too many connections解决

1、如果你的MySQL数据库使用my.cnf文件配置

找到文件 /etc/my.cnf

编辑器打开,修改max_connections的值为10000。实际MySQL服务器允许的最大连接数16384。

set-variable = max_connections=10000

2、如果你的MySQL数据库使用my.ini文件配置

找到文件/bin/my.ini(不一定在这里,根据你的数据库情况)

[mysqld]里面增加
max_connections=10000
如果原来就有,那么可以修改max_connections的值。

3、重启mysql数据库。

这样就可以解决MySQL出现too many connections(1040)错误了。

注意:

注意这里面有两个内容:一个是【mysqld】,一个是【mysqld_safe】

[mysqld]
#datadir=/var/lib/mysql
datadir=/home/data/mysql
#socket=/var/lib/mysql/mysql.sock
socket=/home/data/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
set-variable=max_connections=1000


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
default-character-set=utf8
max_allowed_packet=50M

 

你可能感兴趣的:(mysql too many connections解决)