mysqlbackup – MySQL backups for admins and users

This script allows you to make date-time stamped backups of individual mysql databases. Each database backup is a gzip compressed sql script that can be restored/imported via the mysql command line tool.

The tables of each database being backed up are locked, preserving data integrity. While this does temporarily prevent writes to the tables, the impact is reduced by backing up each database separately.

This script backups all tables accessible to the mysql user that it is configured to use. That means this script is useful to the sysadmin as well as to regular users who whish to maintain backups of their own mysql databases.

This script requires that your mysql connection information be stored in a my.cnf or .my.cnf file in the home directory of the user used to run this script. Because it makes an external call to mysqldump, it is inadvisible to hard code the username and password into this script and then call mysqldump with user and pass as command line arguments. Doing that would expose your mysql username and password to anyone logged into the server while the backup was occurring. For information on how to create a my.cnf file visit this page:

http://dev.mysql.com/doc/refman/5.0/en/option-files.html

The current version is available here: http://www.ghostwheel.com/MySQLBackup-latest.tgz

If you wish to receive notifications when updates are published, visit the Freshmeat project page, and subscribe to this project.

#############################################################################
#                                                                           #
#  History:                                                                 #
#                                                                           #
#  .07-beta  Fixed bad logic in the utility file path code.                 #
#            Added a set of common path locations to the search path.       #
#            Removed information_schema from databases backed up.           #
#                                                                           #
#  .06-beta  Modified sql connect string to no longer specify an initial    #
#            database.  Checks to make sure there is a [mysqldump]          #
#            section in the ~/.my.conf file.                                #
#                                                                           #
#  .05-beta  Initial public release.  First release without hard coded      #
#            values for utility locations, usernames, passwords and hosts.  #
#                                                                           #
#                                                                           #
#############################################################################

One thought on “mysqlbackup – MySQL backups for admins and users”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>