How do I monitor open database sessions associated with MySQL ODBC connections?
Use the following steps to monitor open database sessions associated with MySQL ODBC connections:
- Login to the machine that contains the MySQL instance.
- su to the MySQL user.
- Execute the MySQL user's .profile.
- cd into the bin sub-directory of the MySQL installation.
- Execute the ./mysql procedure and pass your username, password and database like so:
bash-2.03$ ./mysql -u mysql -pdba -D test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g.
- Type SHOW STATUS; (pre-5.x) or SHOW GLOBAL STATUS; (5.x) to return connection information.
For example:
mysql> SHOW STATUS -> ; +--------------------------+-----------+
+--------------------------+-----------+Variable_name Value Aborted_ clients 11218 Aborted_ connects 26620 Bytes_ received 207090542 Bytes_ sent 767911564 Com_ admin_ commands 0 Com_ alter_ table 0 Com_ analyze 0 Com_ backup_ table 0 Com_ begin 0 Com_ change_ db 0 Com_ change_ master 0 Com_ check 0 Com_ commit 200 Com_ create_ db 0 Com_ create_ function 0 Com_ create_ index 8204 Com_ create_ table 11572 Com_ delete 333
The Threads_connected parameter shows the number of active connections. Consult the MySQL Reference Manual for an explanation of other variables.