时间:2021-07-01 10:21:17 帮助过:26人阅读
Processlist
尽量去用select查询
正在running的线程
Select count(*)from information_schema.processlist where info is not null;
Mysql的全部线程
Select count(*)from information_schema.processlist;
查询当前running sql执行时间最长的10条
Select * frominformation_schema.processlist where info is not null order by time desc limit10 ;
查询执行sql的ip 的连接数量
select left(host,instr(host,‘:‘)-1) asip,count(*) as num from information_schema.processlist group by ip order by num desc;
查询执行sql的user的连接数量
select user,count(*) as num from information_schema.processlist group by userorder by num desc;
查询执行sql语句的数量
select count(*) as num,info from information_schema.processlist where info isnot null group by info order by num;
查询mysql服务器最大连接数、当前数据库连接数和running数show global variables like ‘max_connections‘;
show global status like ‘Threads%‘;
查询用户最大连接数
show grants for ‘mysql_bi‘;
slave错误问题,需要确认数据不一致原因
adm和click库可以直接跳过1个错误
一般处理的方式包括
杀掉慢查询进程,可以针对用户,执行时间去操作
select concat(‘KILL ‘,id,‘;‘) frominformation_schema.processlist where user=‘用户名称‘ and time>100into outfile ‘/tmp/aa.txt‘;
source/tmp/aa.txt
本文出自 “云淡风轻” 博客,谢绝转载!
关于查询mysql processlist的建议
标签:mysql show processlist