Create a table from a CSV file with headers
You can use csvsql, which is part of csvkit (a suite of utilities for converting to and working with CSV files):

Linux or Mac OS X
free and open source
sudo pip install csvkit 
Example:  csvsql --dialect mysql --snifflimit 100000 datatwithheaders.csv &gt; mytabledef.sql
It creates a CREATE TABLE statement based on the file content. Column names are taken from the first line of the CSV file.


To extend on ivansabik's answer using pandas, see How to insert pandas dataframe via mysqldb into database?.