用命令show processlist检查一下,到底有多少人连上了mysql mysql> show processlist; +----+------+----------------+------+---------+------+-------+------------------ + | Id | User | Host | db | Command | Time | State | Info | +----+------+----------------+------+---------+------+-------+------------------ + | 1 | root | localhost:1655 | NULL | Query | 0 | NULL | show processlist | +----+------+----------------+------+---------+------+-------+------------------ + 1 row in set (0.01 sec)查看一下日志,看看是发生了什么事?最后用命令show variables like '%max_connection%'查一下你mysql的最大连接数是多少,太小的话就要把它设大. mysql> show variables like '%max_connection%'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | max_connections | 100 | +-----------------+-------+ 1 row in set (0.00 sec)
mysql> show processlist;
+----+------+----------------+------+---------+------+-------+------------------
+
| Id | User | Host | db | Command | Time | State | Info
|
+----+------+----------------+------+---------+------+-------+------------------
+
| 1 | root | localhost:1655 | NULL | Query | 0 | NULL | show processlist
|
+----+------+----------------+------+---------+------+-------+------------------
+
1 row in set (0.01 sec)查看一下日志,看看是发生了什么事?最后用命令show variables like '%max_connection%'查一下你mysql的最大连接数是多少,太小的话就要把它设大.
mysql> show variables like '%max_connection%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 100 |
+-----------------+-------+
1 row in set (0.00 sec)