Advertisement
Home arrow Blog arrow Taking backup of mysql database using cron
Taking backup of mysql database using cron
Tuesday, 20 September 2005
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.





Reddit!Del.icio.us!Google!Live!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Ma.gnolia!Free social bookmarking plugins and extensions for Joomla! websites!
 
< Prev   Next >