Mon 27 Nov 2006
How to set the mysql database backup cronjob ?
Posted by Dave under Dedicated Server Hosting , Linux Web Hosting , MySQL TutorialsCron is a linux utility that schedules a command (or commands) to be executed periodically at certain times. They can perform user-defined tasks such as backing up databases, scheduling mailing lists, clearing old records, etc etc.
To set up a CRON Job, you need to know two things.
1. The command that is to be executed (often a user written script or a UNIX command)
2. How often the command is to be executed (what days, months, dates, hours etc etc)
There are following different format to get the backup of mysql database using cron job
1) Simple cron job syntax to take database backup
* * * * * /usr/bin/mysqldump -u databaseusername databasename -ppassword > /path of database store.sql
2) Compress the database backup in gz format
* * * * * /usr/bin/mysqldump -u databaseusername databasename -ppassword|gzip > /path of database store.gz
3) Compress the database backup in bz2 format
* * * * * /usr/bin/mysqldump -u datbaseusername databasename -pdatbasepassword|bzip2 -c > /path of database store.bz2
Leave a Reply
You must be logged in to post a comment.


















