MYSQL backup - cron job

werwin01

Verified User
Joined
Aug 2, 2004
Messages
34
If anyone can write a script for this, it would help me out greatly.

Hello,

The simplest way to do it would be to write a script to

1) stop mysqld from running (/usr/local/etc/rc.d/mysqld stop)
2) copy the databases to a backup location (from /home/mysql)
3) start mysqld

OR if you've upgraded to 1.22.4, you can always use "sysbk" from the Admin Panel -> System Backup, and then only select to backup the mysql databases. DA just adds a cron job for root (crontab -l -u root) to specify when the "/usr/local/sysbk -q" program should be run.

John
--------------------------------------------------

DirectAdmin Web Control Panel
http://www.directadmin.com

>>>>>>>>>>>>>>>>>>>>>>>>>

I would like to know how I can create a cron job to automatically backup my mysql database every 4 hours? I know DirectAdmin has a backup feature, but using crontab to do it automatically would be preferred.
I am running FreeBSD 4.10.

Thanks,
Will Erwin
 
Something like this?

Code:
* */4 * * * root /usr/local/etc/rc.d/mysqld stop && cp /home/mysql /backup_location && /usr/local/etc/rc.d/mysqld start

Just stick it in your crontab (/etc/crontab)
 
Back
Top