Home > MySQL > MySQL – importing data

MySQL – importing data

February 22nd, 2009 deevis

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>) ;

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • StumbleUpon
  • Technorati
  • TwitThis
Categories: MySQL Tags:
Comments are closed.