Taking backup of mysql database using cron

Create a file called database_backup.sh and also an empty directory called mysql_backup. The database_backup.sh script should have the following info :

————————————————-
#!/bin/sh

date=`date ‘+%m-%d-%y’`
mysqldump -u database_username -pdatabase_password database_name > ~/mysql_backup/database_name.$date
————————————————-

Run the script that performs the backup job.

————————————————-
* 23 * * * your_userid /path/to/backup/script
————————————————-

Set this script up to run every night, etc. as a cron job. It will save an sql dump of your database every night in the mysql_backup.

delicious | digg | reddit | facebook | technorati | stumbleupon | chatintamil

Related posts:

  1. Linux Cron Jobs Explained Cron allows users to automate repetitive system administration tasks such...
  2. How To Set Up A Load-Balanced MySQL Cluster With MySQL 5.1 This tutorial is based on Falko Timme’s tutorial for MySQL...
  3. Moving mySQL DBs between servers Moving mySQL DBs from one server to another: mysqldump -uUSER...
  4. Turbo charging MySQL by setting up the query cache To make sure MySQL uses the query cache, there are...