3 ms·
Or just do something like: LOAD DATA INFILE 'data.csv' INTO TABLE mytable FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGN
by pi-rat 12y ago
Or just do something like:
LOAD DATA INFILE 'data.csv' INTO TABLE mytable
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
- akx 12y agoIf you're fortunate enough to be able to put `data.csv` on the MySQL server, that is.
- jeremysmyth 12y ago...or if you can use the LOAD DATA LOCAL INFILE syntax on that server/client. http://dev.mysql.com/doc/refman/5.6/en/load-data-local.html http://dev.mysql.com/doc/refman/5.6/en/load-data-local.html
- masklinn 12y agoAdd LOCAL (as in, "LOAD DATA LOCAL INFILE") and the path is looked up in the client's filesystem, with the file uploaded through the connection before the command is run.
- akx 12y agoCool. I swear that didn't exist the last time I looked at the docs for LOAD DATA INFILE...