Periodically back up MySQL with a Shell Script

There are many advantages to using the shell, one is making backups. With the following code and a cron job, periodically backing up MySQL databases is a breeze.

#!/bin/sh
mkdir `date +%m-%d-%y-%Hx%M`
cd `date +%m-%d-%y-%Hx%M`
mysqldump -h localhost  -u user -ppassword dbname > file.sql

0 Responses to “Periodically back up MySQL with a Shell Script”


  1. No Comments

Leave a Reply