Taking backup of mysql database using cron
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.
| Print article | This entry was posted by wiredgorilla on March 27, 2009 at 22:56, and is filed under Linux Tutorials, MySQL, Techno Babble. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |







