-s ORDER what to sort by (al, at, ar, c, l, r, t), 'at' is default
al: average lock time
ar: average rows sent
at: average query time
c: count
l: lock time
r: rows sent
t: query time
查出前5条最慢的sql
/data/mysqldb/mysql-8.0.26/bin/mysqldumpslow –s at -t 5 /data/mysqldb/log/mysql-slow.log
查出前10条使用最多的sql
/data/mysqldb/mysql-8.0.26/bin/mysqldumpslow -s c -t 10 /data/mysqldb/log/mysql-slow.log
清理日志 进入日志目录 修改文件名,然后进入mysql安装目录执行
/data/mysqldb/mysql-8.0.26/bin/mysqladmin -u root -p flush-logs就可以重新打印了
U:root
P:PrdRootpwd&123
日志路径/data/mysqldb/log/
nmon -s2 -c3600 -f -m /home/nmon
1、top -H -p pid找到cpu消耗最高的线程TID
2、进入mysql执行select thread_id,name ,PROCESSLIST_ID,THREAD_OS_ID from performance_schema.threads where thread_os_id=TID;找出线程id
3、执行select DIGEST_TEXT from performance_schema.events_statements_current where thread_id = 步骤2线程id; 可以看到正在执行的语句