title: Change output format for MySQL command line results to CSV
body: <p>I want to get headerless CSV data from the output of a query to MySQL on the command line. I'm running this query on a different machine from the MySQL server, so all those Google answers with "INTO OUTFILE" are no good. </p>
  
  <p>So I run <code>mysql -e "select people, places from things"</code>. That outputs stuff that looks kinda like this:</p>
  
  <pre><code>+--------+-------------+
  | people | places      |
  +--------+-------------+
  |   Bill | Raleigh, NC |
  +--------+-------------+
  </code></pre>
  
  <p>Well, that's no good. But hey, look! If I just pipe it to <em>anything</em>, it turns it into a tab-separated list: </p>
  
  <pre><code>people  places
  Bill    Raleigh, NC
  </code></pre>
  
  <p>That's better- at least it's programmatically parseable. But I don't want TSV, I want CSV, and I don't want that header. I can get rid of the header with <code>mysql &lt;stuff&gt; | tail -n +2</code>, but that's a bother I'd like to avoid if MySQL just has a flag to omit it. And I can't just replace all tabs with commas, because that doesn't handle content with commas in it.</p>
  
  <p>So, how can I get MySQL to omit the header and give me data in CSV format?</p>