1、查看当前数据库的连接情况
show full processlist;
shop processlist;
2、查看所有用户的总连接数
show variables like ‘%max_connections%‘;
3、查看每一个用户的最大连接数
show variables like ‘%max_user_connections%‘;
4、查看当前连接中各个用户的连接数
select USER , count(*) from information_schema.processlist group by USER;
5、查看当前连接中各个IP的连接数
select SUBSTRING_INDEX(host,‘:‘,1) as ip , count(*) from information_schema.processlist group by ip;
6、查看当前连接中连接时间最长的的连接
select host,user,time,state,info from information_schema.processlist order by time desc limit 10;
7、查询线上Mysql数据库的连接数配置
show variables like ‘%conn%‘;