MYSQL Data Import
I am trying to import a large csv file into MySQL. It's about 1.4 GB and consists of ~ 1MM rows and 100 columns.
My question is whether there is some way to generically dump the data into a db w/o having to manually define 100 columns.
I know in SQL Server there is a data importing tool that will read the first row of a csv file and figure out what the columns should be.
I have MySQL workbench but can't find a similar feature.
The answer is sadly No, there is no way (using the standard mysql utilities) to create a table by analyzing the data your .csv, and then insert the data into this new table.
You'll need to create the table yourself (either by hand, or preferably using some script).
Then you can import the rest of the data using one of the methods below:
- MySQL 5.0 Reference Manual :: 12.2.6 LOAD DATA INFILE
- MySQL 5.0 Reference Manual :: 4.5.5 mysqlimport — A Data Import Program (recommended)