Reputation: 420
I would like to list the processes in Mysql. I have multiple databases for in my connection. When I say Show process list, the processes of all databases come. How do I view processes for a single database?
Upvotes: 1
Views: 1017
Reputation: 108841
This is a job for the information_schema. That's where SHOW PROCESSLIST
gets its information.
SELECT * FROM information_schema.processlist WHERE DB = DATABASE()
Of course, the function DATABASE()
returns the current database, as chosen by USE DATABASE
or by your login default database.
If for some reason that is not set, and you know the name of your database, try this.
SELECT * FROM information_schema.processlist WHERE DB = 'my_database_name'
Upvotes: 4