Monday, February 2, 2009

load csv to mysql from local file

LOAD DATA LOCAL INFILE '[path to your csv]'
INTO TABLE [table to import into, must be created before running with proper columns]
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
([field 1], [field 2], [field 3], [...]);

link to original article

2 comments:

Month/Day said...

hint: don't use "dos" backslashes, use *nix frontslashes

Month/Day said...

hint: enter through gui "script" tab