Skip to content


mysql cli: importare file csv

LOAD DATA LOCAL INFILE 'path-to-file/file.csv' INTO TABLE table FIELD TERMINATED BY ',' OPTIONALLY ENCLOSED BY """" LINES TERMINATED BY '\n' (field1, field2, field3, .... );

ovviamente vanno cambiati i delimitatori di campo (FIELD TERMINATED BY) e la delimitazione del testo (OPTIONALLY ENCLOSED BY).
Eventualmente (file creati sotto windows) bisogna aggiungere il solito \r al fine riga (LINES TERMINATED BY ‘\r\n’).

Posted in development, system administration.

Tagged with , , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.