博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MySQL 网络访问连接
阅读量:4685 次
发布时间:2019-06-09

本文共 1364 字,大约阅读时间需要 4 分钟。

查看 /etc/hosts配置文件

[hotspot@bogon ~]$ cat /etc/hosts127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain::1         localhost localhost.localdomain localhost6 localhost6.localdomain6172.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

 

转载于:https://www.cnblogs.com/zhengwenqiang/p/7202789.html

你可能感兴趣的文章
31、任务三十一——表单联动
查看>>
python之hasattr、getattr和setattr函数
查看>>
maven使用阿里镜像配置文件
查看>>
Copy code from eclipse to word, save syntax.
查看>>
arguments.callee的作用及替换方案
查看>>
23 Java学习之RandomAccessFile
查看>>
P2709 小B的询问
查看>>
润乾报表 动态控制文本的显示
查看>>
[oracle] 如何使用myBatis在数据库中插入数据并返回主键
查看>>
PHP echo 和 print 语句
查看>>
第一讲 一个简单的Qt程序分析
查看>>
Centos 6.5下的OPENJDK卸载和SUN的JDK安装、环境变量配置
查看>>
poj 1979 Red and Black(dfs)
查看>>
【.Net基础03】HttpWebRequest模拟浏览器登陆
查看>>
UML-画类图与交互图的顺序
查看>>
6月7 考试系统
查看>>
mysql 基本操作
查看>>
zTree async 动态参数处理
查看>>
Oracle学习之常见错误整理
查看>>
HTC Sensation G14开盒
查看>>