the best solution would be to make a short script of this, and call that script from
cron -- you could do it as a one-liner, but it would be ugly and hard to maintain, and there's no advantage to be had. (let me know if you need an example)
try something along these lines, off the top of my head:
SQL="USE $DB_NAME; LOAD LOCAL DATA INFILE '$INPUT_FILE' REPLACE INTO TABLE `$TABLE` LINES TERMINATED BY '|' CHARACTER SET utf8;"
mysql --user=$DB_USER --password=$DB_PASSWD --default_character_set utf8 $DB_NAME -e "$SQL"
As for where to put it, well, that's up to you. Bear in mind that if you use the root
crontab then the script will execute with root permissions, and must be owned by
root (and not be world-writable). For this reason, I sometimes have scripts of this kind in
Hope this helps :)