Cry MySQL How to...
List all the connections
To list all of the connections to the MySQL database server, use the following:
show processlist
This will return the same information that MySQL Administrator shows under "Server Connections".
If you need to avoid having the "info" field (which shows the current command being executed) then insert the "full" keyword:
show full processlist
If you need this as part of a query then use:
select * from information_schema.processlist
This allows you to filter the results, so for example to list all connections to the database "mydb":
select * from information_schema.processlist where db='mydb'
These notes have been tested against MySQL version 5.1.
About the author: Brian Cryer is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.