Display number of Client connected to Database in MySQL

Last Reply 6 months ago By PSowmiya

Posted 6 months ago

hi sir

I want to count the number of systems connected to the server in mysql.

i want only clients connected to the server for particular database belongs to root user.

How to get it

You are viewing reply posted by: PSowmiya 6 months ago.
Posted 6 months ago

thank you sir.

In second link, following query solves my problem

SELECT IFNULL(usr,'All Users') user,IFNULL(hst,'All Hosts') host , COUNT(1) Connections FROM ( SELECT user usr,LEFT(host,LOCATE(':',host) - 1) hst FROM information_schema.processlist WHERE user='root' ) A GROUP BY usr,hst WITH ROLLUP