add mysqldump in cron

by Ramya 2014-02-21 18:46:35

add mysqldump in cron:

In order to add cron job for db using mysqldump use the following line,
* * * * * mysqldump -h remotehostname -uroot -ppwd database > /path to the sql file/


for eg, if you want to backup your db on every friday at 3.10PM, add the following cron job,

10 15 * * 5 mysqldump -h 192.168.0.120 -uramya -pramya userdb > mydb_backup.sql


you can backup multiple databases into a single backup as,

10 15 * * 5 mysqldump -h 192.168.0.120 -uramya -pramya --databases userdb detailsdb > mydb_backup.sql


both the databases will be dumped into a single backup file "mydb_backup.sql"....


613
like
0
dislike
0
mail
flag

You must LOGIN to add comments