首页 > 数据库 > MySQL > 正文

观察MySQL进展状态

2022-08-03 16:45:01
字体:
来源:转载
供稿:网友
       观察MySQL进展状态:

1、测试脚本
      [root@mysql5 ~]# cat proce.sh
     while true
     do
     mysql -uroot -pmysql -e 'show processlist /G'|grep State >> /root/mysql.log
     sleep 1
     done
 
2、tail -f
[root@mysql5 ~]# tail -f mysql.log
  State:
  State: starting
  State:
  State: starting
 
3、对mysql.log按行进行排序、去重、计数
[root@mysql5 ~]# sort mysql.log |uniq -c
     24   State:
     24   State: starting
 
4、根据state的信息,对数据库进行分析。

(编辑:错新网)

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表