mysql how can I execute a query, direct it to an output file, and not have it include in the output file the query I ran to get the data?

I am developing a mysql report and I need to know direct it to an output filewithout the output file including the query I ran to generate the data?  Currently, even if I run it in silent mode and redirect it with the tee command, it sill places in the output file the query I ran.  I don't want that to show up in the report.  Does anyone have any ideas?
navajo26354Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
K VDatabase ConsultantCommented:
mysql -uUSER -pPASS databasename -e  "YOUR QUERY" > outputfile.txt
0
 
max-hbCommented:
Hi!
Assuming you are using Linux/Unix try this:

mysql -insert-your-options < query.sql > outfile.txt

Replace "-insert-your-options" with any information needed to connect to your database, eg. "-u root -p secrecy -h localhost" etc.

CU
 maxhb
0
 
eekygeekyCommented:
To the best of my knowledge, there's no way to do that . You can output the data to a .csv file and anything you use to read the .csv file will ignore the SELECT statement because it won't output as comma seperated. in a .txt file, you will always see the query.

-tee just forks the output so it goes two places at once, like on the screen and to a log file simultaneously.

Most websitesand repotr generating tools  handle this with PHP or something , that can be used to automatically look at the query results and generate a pretty looking webpage or Word document or something. Excel can import .CSVs directly if that's any help.
0
 
bimal_linuxCommented:
0
All Courses

From novice to tech pro — start learning today.