Hi There.

Is it possible to use the LOAD DATA LOCAL INFILE command from a crontab or what will the best way be of importing a csv on a hourly basis.


Recommended Answers

All 2 Replies

shell> mysqlimport [options] db_name textfile1 [textfile2 ...]

See http://dev.mysql.com/doc/refman/5.0/en/mysqlimport.html and particularly, search for a comment about csv files on Windows (which you will want to alter to your specific platform)

Hi GrisWolf

Figured it out yesterday. Thanks for your help.

mysql -u**** -p**** database --execute="LOAD DATA LOCAL INFILE 'C:\\import.csv' INTO TABLE table FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (field1, field2, field3)"


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.