3.1.3 Using the MySQL Enterprise Plugin for Connector/Net

The MySQL Enterprise Plugin for Connector/Net lets you use the Query Analyzer to monitor MySQL queries from any application using Connector/Net, including both standalone and web-based applications. As described in Section 3.2, “Query Analyzer User Interface”, the Query Analyzer can help you locate queries that are inefficient or slow. Tuning such queries helps to shorten load times for web pages, and improves overall system responsiveness and scalability.

Information about the queries is sent directly to the MySQL Enterprise Service Manager. Once you install the MySQL Enterprise Plugin for Connector/Net, query analysis becomes available for your applications without requiring any modification to the application code.

Table 3.7 Query Analyzer Connector/Net Summary

Uses AggregatorNo
Uses ProxyNo
Supports EXPLAINYes



Download the MySQL Enterprise Plugin for Connector/Net package. Extract the package using a suitable zip tool, and then place the plugin library, MySql.MonitorPlugin.dll, in the same directory as your compiled application.


If the application to profile does not have an app.config application configuration file, then make one.

To enable Query Analyzer functionality, register the trace listeners in the System.Diagnostics section of the app.config file. The following example shows the format of a typical configuration file:



    <source name="mysql" switchName="SourceSwitch"


        <add name="EMTrace" type="MySql.EMTrace.EMTraceListener, MySql.MonitorPlugin"





    <add name="SourceSwitch" value="All"/>




    <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
    description=".Net Framework Data Provider for MySQL"
    type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=, \
    Culture=neutral, PublicKeyToken=c5687fc88969c44d" />



Within the configuration, set the values of the following parameters:

To get extended information on queries and have that information available through the Dashboard, enable the Connector/Net usage advisor. The extended information identifies potential issues such as a query not using an index, or not accessing all columns from a result set.

To enable the usage advisor, add usage advisor=true to the connection string within your application. Enabling this option also automatically enables logging within Connector/Net. For more information, see Connector/Net Connection String Options Reference.

During execution of the application during development within Visual Studio, a significant amount of output is displayed in the Output window. To view this same trace output when running the application outside Visual Studio, configure an additional listener by adding the following within the system.diagnostics section of your app.config file:

<trace autoflush="false" indentsize="4">
    <add name="consoleListener" type="System.Diagnostics.ConsoleTraceListener" />


After you set up MySQL Enterprise Plugin for Connector/Net, you monitor the performance of your .NET applications through the Query Analyzer tab, as described in Section 3.2, “Query Analyzer User Interface”.