If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
You can't do it using a select to an outfile. From this thread: http://lists.mysql.com/mysql/163185
I understand you may get what you want using batch mode.
Now I ran it directly from my command prompt and saved the file in the current directory (on WinXP, sure the same works for Linux)
Code:
echo SELECT * from animal | mysql -udavemysql -p***** testdb > mysqloutfile.txt
I found I had to name the database i was using or of course got the no db selected error message.