Generally, changing your MySQL client application is the easiest and recommended method. For example, given a typical structure like the one shown in the figure below, the client application would need to be modified so that it no longer communicated directly with the MySQL server, but to the agent/proxy.
You can see an example of the structure when communicating via the agent/proxy below.
To enable query analyzer within your MySQL client application:
Make sure that the MySQL Enterprise Service Manager and your MySQL Enterprise Monitor Agent are configured and running.
            Confirm the configuration of your agent by examining the
            contents of the
            etc/mysql-monitor-agent.ini file within
            your installed Agent directory.
          
            Queries will be sent to the host specified in the
            proxy-backend-addresses parameter, and
            the agent will listen for connections to be redirected to
            the server on the host name and port configured in the
            proxy-address parameter.
          
            Now modify your MySQL client application to communicate with
            the address specified in the
            proxy-address parameter.
          
Alternatively, if you do not want to modify your application directly, you can use iptables or firewall rules to redirect queries from the original host/port combination to the agent's port.
            Because connections to the MySQL server will be coming from
            the agent/proxy, not the original host, the user credentials
            used must be have a suitable GRANT
            statement for connections from localhost,
            or the host on which the agent/proxy is executing. The user
            name and password information will be passed on directly
            through the agent/proxy from the client to the server.
          
Confirm that your MySQL client application still operates normally. There should be no difference between communicating directly with the MySQL server and communicating via the agent/proxy.
          If you are using the mysql client to
          connect to the agent/proxy and your backend servers, make sure
          that you are communicating with the proxy over the right port.
          By default, if you specify localhost as the
          host name, then mysql will connect using
          the local Unix domain socket, rather than the TCP/IP socket.
        
          You can enforce mysql to use the right port
          either by explicitly requesting the protocol type, or by using
          the IP address rather than localhost. For
          example, both of these command lines will start the client
          using the right protocol:
        
shell> mysql --port=4040 --protocol=tcp shell> mysql --port=4040 --host=127.0.0.1
It is recommended that you use one agent/proxy per MySQL server instance. The agent/proxy is not able to forward queries to multiple MySQL server backends.

