What is equivalent statement of DBCC INPUTBUFFER(@

2019-02-26 04:50发布

问题:

What is the MySQL equivalent statement of DBCC INPUTBUFFER(@@SPID), which lists the sql statement for current connection or specified connection?

回答1:

Use SHOW PROFILES to see a list of the most recent statements sent to MySQL:

SHOW PROFILES;

If you want/need to see currently running queries, use SHOW PROCESSLIST:

SHOW FULL PROCESSLIST;

The FULL keyword means the list will include queries from all clients, not just the one you are running the command on.