This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Mysql allows multiples sessions to the server instance. As a result, you can have different profiling for different sessions, thus it is critical that you set the profiling for the built-in MySQL Profiler from INSIDE the application you are wanting to profile, IF you are desiring to profile live queries versus profiling from the command line on a query by query basis.
Once you have obtained a connection to the database, you execute the following query:
and a temporary table within the information_schema db will be created. ALL queries run by the application will then be measured and recorded and values stored. However, you must capture that information BEFORE your session ends, i.e. the application instance vanishes.
There is alot more to share but the following link is a great help once you know how to start the profiling from inside the app: