mysql show processlist info null_关于查询mysql processlist的建议
查詢mysql進(jìn)程,因?yàn)閿?shù)據(jù)庫(kù)的sleep連接很多(一般都會(huì)在幾千個(gè)左右),不建議直接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í)行時(shí)間最長(zhǎng)的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語(yǔ)句的數(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ù)庫(kù)連接數(shù)和running數(shù)show global variables like ‘max_connections‘;
show global status like ‘Threads%‘;
查詢用戶最大連接數(shù)
show grants for ‘mysql_bi‘;
slave錯(cuò)誤問(wèn)題,需要確認(rèn)數(shù)據(jù)不一致原因
adm和click庫(kù)可以直接跳過(guò)1個(gè)錯(cuò)誤
一般處理的方式包括
殺掉慢查詢進(jìn)程,可以針對(duì)用戶,執(zhí)行時(shí)間去操作
select concat(‘KILL ‘,id,‘;‘) frominformation_schema.processlist where user=‘用戶名稱(chēng)‘ 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的建议的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 2017微信网名男英文
- 下一篇: java修改 nsf中的数据_最新NSF