In MySql\'s interpreter, it\'s very easy to dump a table to the screen along with its field names.
There seems to be no simple way to export a table to a tab-delimt
I achieved that in this way:
echo "select * from table"| mysql database -B -udbuser -puser_passwd | sed s/\\t/,/g > query_output.csv
The -B option of mysql separates the columns by tabs, which are converted into commas using sed. Note that the headers are generated too.