On 21/02/2010, at 2:03 PM, Yang Zhang wrote:
Hi, I'm interested in piping out the contents of a mysql table to
stdout in tab-separated value format, but:
- using 'select * into outfile' can't write to stdout.
- mysqldump --fields-... requires --tab, which requires an output
file path.
- I also tried mkfifo /tmp/pipe and "select * into outfile
'/tmp/pipe'", but mysql complains about the file existing already.
Is there any other quick way to do this without having to write a
client app? Thanks in advance.
You can execute a query from the command line and use the -B (or --
batch) option.
mysql mysql -B -e "SELECT * FROM time_zone LIMIT 5"
Time_zone_id Use_leap_seconds
1 N
2 N
3 N
4 N
5 N