I'm using mysqldump to dump all my tables to CSV files like so:
mysqldump -u -p -t -TC:\Temp --fields-terminated-by=,
Is there an option to have mysqldump include the column names in the first row of each file?
I'm using mysqldump to dump all my tables to CSV files like so:
mysqldump -u -p -t -TC:\Temp --fields-terminated-by=,
Is there an option to have mysqldump include the column names in the first row of each file?
As of MySQL 5.5 (perhaps before) you can now use --complete-insert
or -c
to achieve this.
mysql test -e"select * from users" | tr '\t' ',' > tocsv.csv
This may not be exact but very close to what you are trying to.