mysql最大连接数达到上限

问题:

报错mysql达到最大连接,拒绝连接等等的

原因及解决:

进入到mysql命令:找到mysql的安装目录,一般可以直接键入命令mysql -uroot -p,回车后提示你输密码。

MYSQL的提示符是:mysql>

连接数超过mysql的最大连接数,需要加大这个最大连接数

Icon                

mysql> show global status like 'Max_used_connections'; #已经使用的连接数

+----------------------+-------+

| Variable_name        | Value |

+----------------------+-------+

| Max_used_connections | 152   |

+----------------------+-------+

1 row in set (0.00 sec)

 

mysql> show variables like 'max_connections'; #mysql的最大连接数

+-----------------+-------+

| Variable_name   | Value |

+-----------------+-------+

| max_connections | 151   |

+-----------------+-------+

1 row in set (0.00 sec)

 

mysql> set global max_connections=500;    #修改最大连接数为500

Query OK, 0 rows affected (0.00 sec)

 

mysql> show variables like 'max_connections';

+-----------------+-------+

| Variable_name   | Value |

+-----------------+-------+

| max_connections | 500   |

+-----------------+-------+

1 row in set (0.00 sec)