tags:

views:

3118

answers:

2

Is there a way in MySQL 5 to show only the current user's processes(queries)?

The user has the PROCESS privilege, therefore SHOW PROCESSLIST displays running processes of all users. According to the documentation, SHOW PROCESSLIST does not allow any kind of WHERE syntax, nor did I manage to make it into a subquery.

Of course, I could simply send the query, e.g. in a PHP script, and go through the results in a loop, discarding everything that's not mine, but it seems rather inefficient. Changing the user privileges is not feasible.

Are there any other ways? Thanks in advance.

+2  A: 

If you use MySQL 5.1.7 or newer, you can use the PROCESSLIST table in the INFORMATION_SCHEMA. So you can query it with ordinary SELECT queries and apply filtering conditions in a WHERE clause.

This feature is not implemented in MySQL 5.0 and prior.

Bill Karwin
Just what I was looking for, thanks.
Piskvor
+1  A: 

If the user does not have PROCESS, then SHOW PROCESSLIST will only show their own threads.

staticsan