What's an easy backup script for my mysql databases?
Last updated: 02/08/2012
Here's a short c-shell script you can run from cron. This creates a backup based on the "day of the month", so you always have about 30 days worth of database backups. You could also make this "day of week" if you only want 7 days of backups:
#!/bin/csh cd [directory where this script resides] set d=`/bin/date '+%d'` mysqldump -u [database user] --password=[database password] -h [database host] [database name] > dump_$d.sql
Obviously, you need to modify the items in [ ] to correspond to your specific server and database information.