mysql连接状态

mysql客户端连接服务端时,会请求到服务器端的连接池中。
在my.cnf中配置了连接数的最大值,MySQL服务器允许的最大连接数16384。

max_connections = 1000  #这里为1000

查看当前的连接数可以采用如下方式:

$ sudo netstat -antxp | grep mysql
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      1880/mysqld     
unix  2      [ ACC ]     STREAM     LISTENING     18993    1880/mysqld         /tmp/mysql.sock
unix  3      [ ]         STREAM     CONNECTED     34308    1880/mysqld         /tmp/mysql.sock
unix  3      [ ]         STREAM     CONNECTED     33985    1880/mysqld         /tmp/mysql.sock
unix  3      [ ]         STREAM     CONNECTED     33984    4762/mysql          
unix  3      [ ]         STREAM     CONNECTED     34307    4779/mysql 

mysql>show full processlist;
+----+------+-----------+------+---------+------+-------+------------------+
| Id | User | Host      | db   | Command | Time | State | Info             |
+----+------+-----------+------+---------+------+-------+------------------+
|  2 | root | localhost | NULL | Query   |    0 | NULL  | show processlist |
|  3 | root | localhost | NULL | Sleep   |  271 |       | NULL             |
+----+------+-----------+------+---------+------+-------+------------------+

你可能感兴趣的:(mysql连接状态)