解决Mysql错误:Too many connections的方法, mysql_connect(): Too many connections

 

通过sql语句参看你的最大连接数:

SHOW VARIABLES LIKE "max_connections"

 

修复的方法,以下任选其一:

  1.  为了防止DDoS攻击,添加一个不修改任何配置,只是在代码中添加一个 sleep(1);
  2.  通过sql语句增加链接数
    SET GLOBAL max_connections = 1024;

    或者通过修改 my.cnf (/etc/my.cnf 或者你自定义的~/.my.cnf)配置文件,在 [mysqld] 下面添加一行

    max_connections=1024;
  3. 非使用mysqld脚本自动启动的用户。
    修改$MYSQL_HOME/bin/mysqld_safe文件
    例如:/usr/local/mysql/bin/mysqld_safe这个文件
    grep -n ‘max_connection’ $MYSQL_HOME/bin/mysqld_safe
    修改对应行号的max_connections参数值

 

本文:解决Mysql错误:Too many connections的方法, mysql_connect(): Too many connections

Loading

Add a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.