MySQL – importing data

I needed to bulk load data into a MySQL instance a bit ago and here’s the way to do it:

You should login to mysql and select the correct database/schema prior to running that command.

mysql -uusername -p

use <schema>;

load data local infile 'data.csv' into table <tableName>
fields terminated by ','
enclosed by '"'
lines terminated by '\n'
(<columnName1>,
<columnName2>, <columnName3>) ;

Comments are closed.