• ADADADADAD

    怎么查看连接mysql的ip地址[ mysql数据库 ]

    mysql数据库 时间:2024-12-03 10:27:47

    作者:文/会员上传

    简介:

    查看连接mysql的ip地址的方法:直接查询,语法为【select SUBSTRING_INDEX(host,':',1) as ip , count(*) from information_schema.processlist 】。查看连接mysql的ip

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    查看连接mysql的ip地址的方法:直接查询,语法为【select SUBSTRING_INDEX(host,':',1) as ip , count(*) from information_schema.processlist 】。

    查看连接mysql的ip地址的方法:

    1、最直接的办法如下:

    select SUBSTRING_INDEX(host,':',1) as ip , count(*) from information_schema.processlist group by ip;

    2、要统计数据库的连接数,我们通常情况下是统计总数,没有细分到每个IP上。现在要监控每个IP的连接数,实现方式如下:

    > select SUBSTRING_INDEX(host,':',1) as ip , count(*) from information_schema.processlist group by ip;

    3、通过直接执行也可以实现:

    #mysql -u root -h227.0.0.1 -e"show processlist\G;"| egrep "Host\:" | awk -F: '{ print $2 }'| sort | uniq -c #mysql -u root -h227.0.0.1 --skip-column-names -e"show processlist;"|awk '{print $3}'|awk -F":" '{print $1}'|sort|uniq –c
    怎么查看连接mysql的ip地址.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: mysqlip地址