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.

Regards

Recommended Answers

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)

Jump to Post

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)"

Regards

Be a part of the DaniWeb community

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