Announcement

Collapse
No announcement yet.

Add cron for database using "mysqldump"

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Add cron for database using "mysqldump"

    Use below step to add cron job for database using mysqldump :
    ===================
    * * * * * mysqldump -h remotehostname -uroot -ppassword database > /path/to/the/sql file/
    ===================

    Example : If you want to backup your db on every Sunday at 11.30 PM, add the following cron job,
    ===================
    30 23 * * 7 mysqldump -h 192.168.0.1 -uspark -pspark sparkdb > /home/sparkdb_backup.sql
    ===================

    Also you can backup multiple databases into a single backup file. To do this use below step :
    ===================
    30 23 * * 7 mysqldump -h 192.168.0.1 -uspark -pspark --databases sparkdb userdb mydb > /home/mydatabase_backup.sql
    ===================

    All the 3 databases will be dumped into a single backup file mydatabase_backup.sql
Working...
X