I'm using mysqldump to dump all my tables to 开发者_C百科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.
There is not; you'll have to do that yourself.
mysql test -e"select * from users" | tr '\t' ',' > tocsv.csv
This may not be exact but very close to what you are trying to.
精彩评论