0

I have an application that is constantly sending queries to a MySQL database. I want to know the results of the queries sent by this application by only modifying the configuration of mysql, no the application itself (I have no control over it). How can I manage to do that?

1 Answer 1

1

The Answer to your question is fairly simple

If you want to log the output from more than one query -- either an entire MySQL client session, or part of a session -- it's easier to use the MySQL tee command to send output to both

1. Your console and

2. A text file.

To get the logging process started, just use the tee command at the MySQL client prompt, like this:

mysql> tee /tmp/my.out;

That command tells MySQL to log both the input and output of your current MySQL login session to a file named /tmp/my.out.

After you issue this tee command, you should see MySQL respond like this:

Logging to file /tmp/my.out I just verified this with my MySQL client (version 5.0.x), and it works as advertised. Everything I typed in, and everything MySQL prints back to me, was saved to my log file.

Update 1 Since, you do not have access to the application, the only way I can figure out is by intercepting all the requests received by the server and dumping them over to a file along with its response. If, you wish to do so, here is a Software, that might be beneficial https://portswigger.net/burp/

Sign up to request clarification or add additional context in comments.

7 Comments

Thank you for the quick response, but it didn't work the way I wanted. There's a Java app running (that uses mysql) that is constantly performing sql queries and when I used the tee command, it only showed me: mysql> exit;
Well, if it is Java, you should have mentioned it right in the question. Here is a link to the documentation which might be helpful. Do Let me know if it works so that, I update my answer as well. commons.apache.org/proper/commons-io/javadocs/api-1.4/org/…
So that means you wish to save the output of all the queries executed in Java to a file. Am I right ? If not, Do let us know what exactly are you upto. As far as this question is concerned, my answer is upto mark. Kindly make changes to your question specifying more details.
Sorry, I have not explained myself very well. Ignore for a moment that is Java, think of an application that is constantly sending queries to the database (mysql), I want to know the results of the queries sent by this application by only modifying the configuration of mysql, no the application itself (I have no control over it).
Do you have control over mysql Database ?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.