Thursday, June 15, 2023

.::: List sessions / active connections on MySQL, MariaDB :::.

show status where variable_name like 'threads%';

1. open tab useing cli or mysql workbench or dbviewer
 



2. -- sedang query
show status where variable_name = 'threads_running';
 


3. -- total connection baik sedang query maupun tidak
show status where variable_name = 'Threads_connected';

4. -- total connection baik sedang query maupun tidak
SHOW STATUS WHERE variable_name = 'Max_used_connections';

5. -- detail total connection all
show processlist;
SELECT @@hostname,User,host,db,command,time FROM INFORMATION_SCHEMA.PROCESSLIS
T;
 
SELECT @@hostname,User,host,db,command,time,time_ms,state FROM INFORMATION_SCHEMA.PROCESSLIST;
 


6. -- detail specification example filter by user, db, host
SELECT @@hostname,User,host,db,command,time FROM INFORMATION_SCHEMA.PROCESSLIST where User='teguh';
SELECT @@hostname,User,host,db,command,time FROM INFORMATION_SCHEMA.PROCESSLIST where db='teguhth';
SELECT @@hostname,User,host,db,command,time FROM INFORMATION_SCHEMA.PROCESSLIST where host like '10.10.10.254%';

 


7. resume query

show status where variable_name like 'threads%';
 
show status where variable_name = 'threads_running';
show status where variable_name = 'Threads_connected';
SHOW STATUS WHERE variable_name = 'Max_used_connections';
show processlist;
SELECT @@hostname,User,host,db,command,time FROM INFORMATION_SCHEMA.PROCESSLIST;
SELECT @@hostname,User,host,db,command,time FROM INFORMATION_SCHEMA.PROCESSLIST where User='teguh';
SELECT @@hostname,User,host,db,command,time FROM INFORMATION_SCHEMA.PROCESSLIST where db='teguhth';
SELECT @@hostname,User,host,db,command,time FROM INFORMATION_SCHEMA.PROCESSLIST where host like '10.10.10.254%';

No comments:

Post a Comment

Popular Posts