开发者

mysqldump option to include column names in first row

开发者 https://www.devze.com 2023-01-31 04:19 出处:网络
I\'m using mysqldump to dump all my tables to 开发者_C百科CSV files like so: mysqldump -u-p -t -TC:\\Temp--fields-terminated-by=,

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号