I'm developing a web app using Java servlet to access Mysql db, how can I get the number of connections to my DB that is currently open ?
Edit :
I tried "show processlist", it showed me : 2695159, but that's not right, I'm just developing this new project, I'm the only user, couldn't have that many processes running, what I want is the number of users accessing my project's DB, not the number of all db users, but just the ones logged in to my database which has only one table.
By default, SQL Server allows a maximum of 32767 concurrent connections which is the maximum number of users that can simultaneously log in to the SQL server instance.
In SQL Server Management Studio, right click on Server, choose "Activity Monitor" from context menu -or- use keyboard shortcut Ctrl + Alt + A .
SELECT * FROM sys. dm_os_performance_counters WHERE counter_name = 'User Connections'; We can see the results here: You also get it via Performance Monitor directly by looking at these counters.
Depending on your MySQL version, you can perform a select on
SELECT COUNT(*) FROM information_schema.PROCESSLIST;
and you can do a where
between the user, database, and host IP.
For example:
USE information_schema;
SELECT COUNT(*) FROM PROCESSLIST WHERE db ="mycase" AND HOST LIKE "192.168.11.174%"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With