date=`date -I`; mysqldump -uyourusername -pyourpassword ——all-databases > /home/LOGIN/backups/xbackup_$date.sql; gzip /home/LOGIN/backups/xbackup_$date.sql
he date line formats the date so that we can append it to our backup filename. We then ask mysql to dump all databases into /home/LOGIN/public_html/backups/xbackup_$date.sql,
where LOGIN is your Cpanel name, using “yourusername” as user (-u) and
“yourpassword” as the password (-p). Notice the date variable inserted
in the filename. Finally our SQL file is gzipped using the gzip directive.
Wednesday, April 8, 2009
Cron job to backup mysql database
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment