zoukankan      html  css  js  c++  java
  • MySQL 网络访问连接

    查看 /etc/hosts配置文件

    [hotspot@bogon ~]$ cat /etc/hosts
    127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    172.16.11.52 bogon

    分主机查看连接数

    mysql> select count(1) '连接数',host_db.host '客户端' from ( select substring_index(host,':',1) as "host" from processlist ) host_db group by host_db.host;
    +------+---------------+
    | 连接数 | 客户端          |
    +------+---------------+
    |    3 | 172.16.91.237 |
    |    3 | 172.16.91.249 |
    |  186 | bogon         |
    |   12 | localhost     |
    +------+---------------+
    4 rows in set

    上面表格中bogon和localhost都是访问本机,但连接数的差异,是因为jdbc.url的ip地址使用的不同,如果是127.0.0.1 会被映射为localhost,如果是172.16.11.52 则映射为bogon

    分数据库查看连接数

    mysql> select count(1) '连接数',db '数据库' from processlist group by db;
    +------+--------------------+
    | 连接数 | 数据库               |
    +------+--------------------+
    |    1 | NULL               |
    |    3 | bpm                |
    |    3 | bpm_ys             |
    |    3 | epm                |
    |    2 | information_schema |
    |  119 | perform2           |
    |    5 | pms                |
    |   39 | portal             |
    |   29 | security_ys        |
    +------+--------------------+
    9 rows in set

    bash 命令行查看连接数

    mysql -uroot -proot --database='information_schema' -e "select count(1) '连接数',db '数据库名' from processlist group by db;" 2>/dev/null
  • 相关阅读:
    PHP线程安全和非线程安全有什么区别
    SHOW SLAVE STATUS 详解
    linux 2>&1
    crontab 例行性排程
    clang-format 数组初始化,多行模式
    windows 10 1909 无法启用 .NET Framework 解决
    SysCtlDelay 实现延时
    wpa_supplicant 检测错误密码
    swig python dynamic module does not define init function
    讯飞错误码10116
  • 原文地址:https://www.cnblogs.com/zhengwenqiang/p/7202789.html
Copyright © 2011-2022 走看看