mysql show processlist info null_关于查询mysql processlist的建议
查詢mysql進程,因為數(shù)據(jù)庫的sleep連接很多(一般都會在幾千個左右),不建議直接show processlist或者show full
Processlist
盡量去用select查詢
正在running的線程
Select?count(*)from information_schema.processlist where info is not null;
Mysql的全部線程
Select?count(*)from information_schema.processlist;
查詢當(dāng)前running sql執(zhí)行時間最長的10條
Select * frominformation_schema.processlist where info is not null order by time desc limit10 ;
查詢執(zhí)行sql的ip 的連接數(shù)量
select left(host,instr(host,‘:‘)-1) asip,count(*) as num from?information_schema.processlist group by ip order by num desc;
查詢執(zhí)行sql的user的連接數(shù)量
select user,count(*) as num from? information_schema.processlist group by userorder by num desc;
查詢執(zhí)行sql語句的數(shù)量
select count(*) as num,info from? information_schema.processlist where info isnot null group by info order by num;
查詢mysql服務(wù)器最大連接數(shù)、當(dāng)前數(shù)據(jù)庫連接數(shù)和running數(shù)show global variables like ‘max_connections‘;
show global status like ‘Threads%‘;
查詢用戶最大連接數(shù)
show grants for ‘mysql_bi‘;
slave錯誤問題,需要確認(rèn)數(shù)據(jù)不一致原因
adm和click庫可以直接跳過1個錯誤
一般處理的方式包括
殺掉慢查詢進程,可以針對用戶,執(zhí)行時間去操作
select concat(‘KILL ‘,id,‘;‘) frominformation_schema.processlist where user=‘用戶名稱‘ and time>100into outfile ‘/tmp/aa.txt‘;
source/tmp/aa.txt
本文出自 “云淡風(fēng)輕” 博客,謝絕轉(zhuǎn)載!
原文:http://liuminkun.blog.51cto.com/10171900/1685492
總結(jié)
以上是生活随笔為你收集整理的mysql show processlist info null_关于查询mysql processlist的建议的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2017微信网名男英文
- 下一篇: 霍比特人百度云