mybackup - a perl wrapper for mysqldump to backup up all MySQL databases.


Mybackup is a utility which calls mysqldump and saves .sql and .txt files to a directory "tree" of your choice. I.E. if you select the backup directory as /var/lib/mysql_backup and you have a database called mydb and a table in mydb called mytable, mybackup will create /var/lib/mysql_backup/mydb/mytable.txt and /var/lib/mysql_backup/mydb/mytable.sql. Mybackup will run on most all flavors of linux with Perl and DBI (+ MySQL DBD driver) installed. See the Manual page link below for a more technical details.



September 9th, 2008     Myrestore updated to use tab delimited data, thanks to Tomas Pospisek for catching that oversight.

July 24th, 2008     Yes, thats 3 years since the last update(!). Released Version .9.6. Changes submitted by Tomas Pospisek (thanks!):
- option to exclude databases
- by default exclude MySql's information_schema metainfo DB
- access TABLE STATUS rows by name instead of position
- use the standard '-' for STDOUT instead of 'BLANK' which wouldn't work
- open log file before writing any output

April 13th, 2005     Finally submitted my taxes last night, but the news that really belongs here: Released Version .9.5c :). This release comes thanks to a patch from Mauro Canal. His patches fixed a few small bugs that I never got around to fixing related to permissions as well as replaced some platform specific system calls with native perl stuff via the File::Copy module. Thanks Mauro!

January 15th, 2004     Myrestore FINALLY started. I just got around to starting the first draft of Myrestore, the disaster recovery compliment to Mybackup. The code is extremely rough and needs work, but will work to restore all of your databases. Currently it requires that you run it from the database server and is not yet blob column safe. I'll try to make changes in the code to fix the issues when I get a chance (which at this rate may be a few years? :) ). You can download Myrestore Version 0.0.1 here.

December 5th, 2002     Released Version .9.5: Wow, has it been that long since the last update? After receiving a bug report from Bryan Lyons regarding a change in the specs for the Getopt::Long module (which was updated in the latest version of Perl), I have modified the code to get rid of any options that use upper case letters as the Getopt module is now case insensative. Also, I have added forward declarations for the subroutines which are defined at the bottom of the script to get around some errors in newer versions of Perl.

July 25th, 2001     Released Version .9.4: only a small upgrade on this release. Mauro Canal submitted a feature that allows the option to backup /etc/my.cnf with the '-c' command line switch

May 3rd, 2001     Released Version .9.3: I added a brand new feature to mybackup allowing files larger than 2 gigabytes to be broken into smaller 2 gig chunks. this feature uses the unix "split" command to actually perform the file split. See the manpage for more details. Note that there is still a bug from release .9.2 that prevents successfull database connections to remote hosts (the script works fine for localhost which is the most common use anyway). The problem stems from a limitation in the mysqldump utility which will only created a set of .sql and .txt files with the --tab option if the destination server of mysqldump is localhost...

April 24th, 2001     Released Version .9.2: Jakob Schlyter found (and submitted a patch for) a bug that prevented the program from connecting to remote hosts. That's what I get for only running my version on localhost :-). Thanks Jakob!

April 11th, 2001     Released Version .9.1: Ilja Slepnev commented that the password field should be quoted when passing the value to the shell. It has been fixed in this release.

March 16th, 2001     Released Version .9.0: Hans Rakers discovered a bug with the gzip portion of the code. Existing .sql.gz and .txt.gz files were not being deleted on each run of the program causing an error. Hans submitted a patch which was applied to this version. I have moved the version number up to .9 as I this is the first bug report I've heard in a while. I'm hoping this means the code is getting ever closer to being stable. Either that or no one cares ;-)

November 12th, 2000     Released Version .1.2: Noel Clarkson found and submitted a fix for a bug with regard to the passing of the password to mysqldump.

September 28th, 2000     Released Version .0.1.1: This release fixed a bug which would issue an error if no command line input was entered.

August 12th, 2000     Monty Widenius put mybackup into the "contributed" section of the MySQL homepage.

August 11th, 2000     Version 0.1 (alpha) released. This is the first version of the program and I plan to add more options when I find the time. Announcement sent to the MySQL mailing list.

PLEASE read the documentation before e-mailing questions

Marc Swanson <>