Backup Cron Job

Lincoln Turner plug-discuss@lists.plug.phoenix.az.us
Mon, 23 Sep 2002 13:57:44 -0700


Instead of stopping/starting MySQL, you might want to try using mysqldump - that
way, nothing has to go down.

Typically I just do:

   mysqldump --quick --all-databases -u <user> -p<pass> -h <server> | 
                gzip > myDBs.sql.gz

(The --quick is because MySQL's buffers sometimes screw things up if the DB is
large, --quick seems to solve this).

I backup to another machine - hence if something catastrophic happens, I will
have a backup somewhere.


Hope this helps,
Linc


>   I have a Linux server running Apache/PHP/MySQL, and want to setup
> automatic daily backups for the database. I'm planning to install a second
> hard drive to receive the backup data, and will modify the web site to
> exclude access while backups occur. I'm wondering if anyone has written
> scripts to do similar tasks and would be willing to share some examples. I'm
> thinking the script needs to do something like the following:
> Stop MySQL
> Copy the database files to the backup drive
> Restart MySQL
>   It also would be nice to get a daily report of disk usage and the size of
> the backups. If anyone has any tips or examples they would be much
> appreciated.
> Thanks,
> --
> Phil Mattison
> Ohmikron Corp.
> 480-722-9595
> 602-820-9452 Mobile
> 
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change  you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss

--
Lincoln Turner                 Voice: (480) 443-0200
Kahala Corp                    Cell:  (480) 227-7306
lsturner@kahalacorp.com        Fax:   (480) 443-1972