6

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?

scumdogg
  • 452
  • 1
  • 6
  • 15

3 Answers3

6

As of MySQL 5.5 (perhaps before) you can now use --complete-insert or -c to achieve this.

Yvan
  • 2,539
  • 26
  • 28
2

There is not; you'll have to do that yourself.

Glen Solsberry
  • 11,960
  • 15
  • 69
  • 94
1
mysql test -e"select * from users" | tr '\t' ',' > tocsv.csv

This may not be exact but very close to what you are trying to.

shantanuo
  • 31,689
  • 78
  • 245
  • 403