4

When I run the mysql command line tool in non interactive mode and just watch the results, I see them as each query is executed. But if I pipe it to "tee", mysql is buffering the results and I only see it all af the end. How can I instruct mysql to output the results right away? I already tried "-q" to no success, I can't find the right option in the help page. :(

Example: query_dates.txt contains 200 queries each taking about 30 seconds.

head -4 query_dates.txt | mysql -u tester -h 172.16.77.30 myDB -ss 2015-05-01 375398346 2015-05-02 375704957 2015-05-03 375992591 2015-05-04 376193384 

In this case, I see each line every 30 seconds, across 2 minutes.

head -4 query_dates.txt | mysql -u tester -h 172.16.77.30 myDB -ss | tee 001.date_itemid.txt 2015-05-01 375398346 2015-05-02 375704957 2015-05-03 375992591 2015-05-04 376193384 

In this case, I have to wait 2 minutes and at the end I get the 4 results.

P.S.: I found this and using stdbuf in mysql worked, but I still would like to know which mysql option does the trick... if any.

1 Answer 1

5

From the man page:

  • --unbuffered, -n
    Flush the buffer after each query.
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.