<docbook><section><title>MonitorMySQLSessions</title><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> How do I monitor open database sessions associated with MySQL ODBC connections?  </bridgehead>
<para>Use the following steps to monitor open database sessions associated with MySQL ODBC connections:   </para>
<orderedlist spacing="compact"><listitem>Login to the machine that contains the MySQL instance.
</listitem>
<listitem>su to the MySQL user.
</listitem>
<listitem>Execute the MySQL user&#39;s .profile.
</listitem>
<listitem>cd into the bin sub-directory of the MySQL installation.
</listitem>
<listitem>Execute the ./mysql procedure and pass your username, password and database like so:     <programlisting>
  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.
   </programlisting> </listitem>
<listitem>Type SHOW STATUS; (pre-5.x) or SHOW GLOBAL STATUS; (5.x) to return connection information.
 For example:     <programlisting>
mysql&gt; SHOW STATUS
   -&gt; ;
+--------------------------+-----------+
</programlisting>
<table><title /><tgroup><thead /><tbody>
<row><entry> Variable_name            </entry><entry> Value     </entry></row>
</tbody></tgroup></table>
 +--------------------------+-----------+ 
<table><title /><tgroup><thead /><tbody>
<row><entry> Aborted_ clients          </entry><entry> 11218     </entry></row>
<row><entry> Aborted_ connects         </entry><entry> 26620     </entry></row>
<row><entry> Bytes_ received           </entry><entry> 207090542 </entry></row>
<row><entry> Bytes_ sent               </entry><entry> 767911564 </entry></row>
<row><entry> Com_  admin_ commands       </entry><entry> 0         </entry></row>
<row><entry> Com_ alter_ table          </entry><entry> 0         </entry></row>
<row><entry> Com_ analyze              </entry><entry> 0         </entry></row>
<row><entry> Com_ backup_ table         </entry><entry> 0         </entry></row>
<row><entry> Com_ begin                </entry><entry> 0         </entry></row>
<row><entry> Com_ change_ db            </entry><entry> 0         </entry></row>
<row><entry> Com_ change_ master        </entry><entry> 0         </entry></row>
<row><entry> Com_ check                </entry><entry> 0         </entry></row>
<row><entry> Com_ commit               </entry><entry> 200       </entry></row>
<row><entry> Com_ create_ db            </entry><entry> 0         </entry></row>
<row><entry> Com_ create_ function      </entry><entry> 0         </entry></row>
<row><entry> Com_ create_ index         </entry><entry> 8204      </entry></row>
<row><entry> Com_ create_ table         </entry><entry> 11572     </entry></row>
<row><entry> Com_ delete               </entry><entry> 333       </entry></row>
</tbody></tgroup></table>
      The Threads_connected parameter shows the number of active connections.
 Consult the MySQL Reference Manual for an explanation of other variables.
</listitem>
</orderedlist></section></docbook>