Edenshaw
Edenshaw

Reputation: 1757

Log all queries' result in MySQL

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?

Upvotes: 0

Views: 2324

Answers (1)

Panda
Panda

Reputation: 2520

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/

Upvotes: 1

Related Questions