Re: Backups, best practices

From: Date: Thu, 06 Sep 2001 15:19:48 +0000
Subject: Re: Backups, best practices
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-12224@lists.php.net to get a copy of this message
I use a script, written in Perl, that I run manually (but could be added to a cron tab): --- Starting of the script #!/usr/bin/perl print "Starting...\n"; ### Some variables $BASEDIR = "/home/backup"; $dump_path = "/usr/bin/mysqldump"; $date_path = "/bin/date"; # path to "date" $date_format = "+%d%b%Y"; # dateformat ddMonYear for file name $filedate = $date_path $date_format; chomp($filedate); $filedate =~ s/\s//g; # no spaces in there (like on the 1st of the month) # Dumping the databases print "Dumping Databases...\n"; exec "mysqldump --all-databases --quick -uroot -p | gzip > $BASEDIR/$filedate-MySQL.gz"; print "E finito!\n"; --- End of the script This will ask you for the password of the user root (did you set this up? :) ) and pass the output to gzip that compress it. The final file is on the directory '/home/backup' and named '010101-MySQL.gz' (if you run the script the 1st of January of 2001). Of course, you could go further and do it progresively... This is quick and dirty, but it works! :) Regards, Tomás > I'm just wondering how everyone manages their MySQL backups, I'm > looking for a better solution than manual. any scripts or example > would be especially appreciated. tnks +-- --+ Tomás García Ferrari Bigital http://bigital.com/ +-- --+

« previous php.db (#12224) next »