show processlist;
二、mysql查看已经执行的历史sql语句(方法:开启日志模式)
开启日志
SET GLOBAL log_output ='TABLE';
SET GLOBAL general_log ='ON';
查看是否开启
show variables like ‘%log_output%’;
show variables like ‘%general_log%’;
查询sql
SELECT CONVERT(argument USING utf8) as s,event_time,user_host FROM mysql.general_log;
关闭日志
SET GLOBAL log_output ='FILE';
SET GLOBAL general_log ='OFF';