#!/bin/bash
while true
do
date +%Y%m%d-%H:%M:%S
mysql -uroot -p'xxx' -e "select count(1) from information_schema.processlist"
echo '---'
mysql -uroot -p'xxx' -e "select ID,USER,HOST,DB,COMMAND,TIME,count(USER) from information_schema.processlist group by USER;"
echo '#################'
sleep 60
done
time 单位是秒
uploading-image-665049.png