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:

Unknown said...

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

Unknown said...

hint: enter through gui "script" tab