MySQL User Connection Analysis

Total Thread Connections

show status where variable_name = 'threads_connected';

Max Connections

The connected threads are limited by max_connections:

show variables like 'max_connections'; SET GLOBAL max_connections = 350;

Connection Timeout

The connected threads timeout and are closed if they are inactive for too long.

show variables like 'wait_timeout'; -- applies to new connection sessions only - 20 minutes (default 28800 is 8 hours) SET GLOBAL wait_timeout = 1200; -- seconds

Running Threads

Top Hosts

If you want to know which hosts and users are taking up the most open connections quickly and easily:

Top Hosts By User