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/
+--                                         --+



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to