mysqlhotcopy a low resource consuming mysql backup

mysqlhotcopy is a perl script that can backup mysql databases using the MyISAM engines(InnoDb is not supported!) in a faster and efficient way

Following is a simple script to backup all your database to a directory (Preferably this directory should be in a hard drive different from your mysql databases so that there is no data loss in the event of a hard drive failure)

for db in `ls /var/lib/mysql`; do if [ -d $db ];then mysqlhotcopy $db /opt/db_backups;fi; done

You can use the –user=<mysql-user> and –password=<password> options if your mysql server requires it to be passed via command line . Here the database will be backed up in the folder /opt/db_backups ; you can change this to your requirement

Posted under mysql

This post was written by Anoop Alias on May 12, 2008

Tags: