backup your MySQL using a bash script and cron job

useful sql backup command
1. dump the DB into a sql file
mysqldump -u <username> -p<password> <database> > <output file name>.sql

2. compress it
gzip <Filename>

3. Ftp send to backup server
** it is not suggested because backup ftp account and the backup data is sent in plain text format **

ftp -n $ftpserver <<END_SCRIPT
quote USER $ftpuser
quote PASS $ftppwd
put $gzipOutFile
exit 0

Leave a Reply

Your email address will not be published.