You can use the MySQL command line cliet to execute a command something like
select * from someTable into outfile 'somFile.csv'
fields optionally enclosed by '"' terminated by ',' lines terminated by '\n';
Stick that in an SQL script file (with additional SELECTs if appropriate) then you can execute:
mysql -u username --password=******** < sqlscript.sql
Add that command to cron
with crontab -e
and you should be done.
A couple of gotchas:
- make sure the user that cron is executing as has appropriate rights to the filesystem
- the mySQL user you're logging in as will need FILE
privilege
- you might need some extra commands to move the CSV files about after they're created.