当前位置:Gxlcms > 数据库问题 > 【mysql】查询正在执行的语句

【mysql】查询正在执行的语句

时间:2021-07-01 10:21:17 帮助过:27人阅读

-- use information_schema; 2 -- show processlist; 3 或者: 4 -- select * from information_schema.`PROCESSLIST` where info is not null;

2、开启日志模式。(可以记录)

1 -- 1、设置
2 -- SET GLOBAL log_output = ‘TABLE‘;  SET GLOBAL general_log = ‘ON‘;
3 -- SET GLOBAL log_output = ‘TABLE‘;  SET GLOBAL general_log = ‘OFF‘;
4 
5 -- 2、查询
6 SELECT * from mysql.general_log ORDER BY    event_time DESC
7 
8 -- 3、清空表(delete对于这个表,不允许使用,只能用truncate)
9 -- truncate table mysql.general_log;

注意:truncate 删除该表不会产生碎片。收集完成之后,需要及时关闭日志模式

【mysql】查询正在执行的语句

标签:pre   保存   正在执行   class   语句   code   format   span   tput   

人气教程排行