美文网首页
mysql连接状态

mysql连接状态

作者: 金色的清晨 | 来源:发表于2016-12-27 00:21 被阅读0次

    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连接状态

          本文链接:https://www.haomeiwen.com/subject/ylesvttx.html