Include headers when using SELECT INTO OUTFILE?
问题 Is it possible to include the headers somehow when using the MySQL INTO OUTFILE ? 回答1: You'd have to hard code those headers yourself. Something like: SELECT 'ColName1', 'ColName2', 'ColName3' UNION ALL SELECT ColName1, ColName2, ColName3 FROM YourTable INTO OUTFILE '/path/outfile' 回答2: The solution provided by Joe Steanelli works, but making a list of columns is inconvenient when dozens or hundreds of columns are involved. Here's how to get column list of table my_table in my_schema . --