The way I do it is to call mysqldump.exe from perl, granted it's not the most elegant
way but it's certainly the fastest (to code). Just do:
---
# name or IP address of dbmachine
my $DB_server = localhost.localdomain.tld
# db login authorised to do db dump
my $DB_User = sa
# location and name of dumpfile
my $DB_dumpfile = "/tmp/db_dumps/my_dump.sql"
# define command with parameters to dump the database
my $cmd = "mysqldump --add-locks --add-drop-tables --all-databases --lock-tables
--host=$DB_Server --user=$DB_User > $DB_dumpfile";
# run command to dump the database
my $retval = system($cmd);
# check the return value of the dump command
if ($retval != 0)
{
# there was a problem do something about it...
}
---
-Pete
P.S.: This is not production grade code, just something I threw together for you while
eating a sandwich :)
sql
---
-----Original Message-----
From: Jeff Snoxell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 11:16
To: [EMAIL PROTECTED]
Subject: Programmatic MySQL backup in Perl
Hi,
is there an easy way to programmatically backup MySQL database tables using
Perl? My Perl code will be running on a machine remote to the MySQL server.
Ta,
Jeff
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php