0

hey I am newbie to scripting in linux.I want to take a sqldump of my database every hour, I have gone thorough couple of blogs i was able to write a script which will take the dump of my database but I do I make it run every hour in the crontab.

Kindly help me out.

2 Answers 2

2

taking dump of database every hour is not a good option. if size of database is large, then most of system resources would be busy in just taking dump every hour. better consider INCREMENTAL backups, in which you only backup the changed area of the database and not the whole database.

Making Incremental Backups by Enabling the Binary Log

MySQL supports incremental backups: You must start the server with the --log-bin option to enable binary logging. The binary log files provide you with the information you need to replicate changes to the database that are made subsequent to the point at which you performed a backup. At the moment you want to make an incremental backup (containing all changes that happened since the last full or incremental backup), you should rotate the binary log by using FLUSH LOGS. This done, you need to copy to the backup location all binary logs which range from the one of the moment of the last full or incremental backup to the last but one. These binary logs are the incremental backup; at restore time, you apply them, “Point-in-Time (Incremental) Recovery Using the Binary Log”. The next time you do a full backup, you should also rotate the binary log using FLUSH LOGS, mysqldump --flush-logs, or mysqlhotcopy --flushlog.

for different types of backups in mysql, goto this url:

http://dev.mysql.com/doc/refman/5.1/en/backup-methods.html

2

You will use cron for this. Edit your crontab and add something like

* /1 * * * <your script>

To edit your crontab, use

crontab -e
1
  • 1
    <your script> = mysqldump or a wrapped version of it. Nov 12, 2011 at 8:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .