SELECT… INTO OUTFILE Vs Redirecting MySQL Output using --tee option

As promised earlier :) Today I am writing down some information on SELECT… INTO OUTFILE Vs Redirecting MySQL Output using --tee option. I did some research and below are my findings. If anyone has any more information on this please feel free to add it in the form of comments…!!

SELECT … INTO OUTFILE:
  • The SELECT ... INTO OUTFILE statement is intended primarily to let you very quickly dump a table to a text file on the server machine. If you want to create the resulting file on some other host than the server host, you normally cannot use SELECT ... INTO OUTFILE since there is no way to write a path to the file relative to the server host's file system.
  • You need to have a Login account probably to retrieve the file from the Server machine.

Redirecting MySQL Output using –tee option:
  • By using the --tee option when you invoke MySQL, you can log statements and their output. All the data displayed on the screen is appended into a given file. This can be very useful for debugging purposes also MySQL flushes results to the file after each statement, just before it prints its next prompt. Tee functionality works only in interactive mode.
  • A tee file session log has more context because it contains both query input and output and not just the text of the queries.
  • MySQL session logging can be controlled using \T & \t commands.
  • Logs MySQL interaction on client host.
Keep visiting Software Testers Forum for more interesting articles & tutorials. Happy Reading..!!

SELECT… INTO OUTFILE Vs Redirecting MySQL Output using --tee option SELECT… INTO OUTFILE Vs Redirecting MySQL Output using --tee option Reviewed by Suntaragali The Smart Techie on February 21, 2013 Rating: 5

No comments: