Saturday, December 29, 2012

Automated Mysql Server Backup on ubuntu 10.04

#!/bin/bash

#
# if using root then not required
#

sudo su

sudo apt-get install automysqlbackup

vi /etc/default/automysqlbackup


# Host name (or IP address) of MySQL server e.g localhost
DBHOST=localhost

DBNAMES=`find /var/lib/mysql -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f5 | grep -v ^mysql\$ | tr \\\r\\\n ,\ `

# Backup directory location e.g /backups
# Folders inside this one will be created (daily, weekly, etc.), and the
# subfolders will be database names.


BACKUPDIR="/var/lib/automysqlbackup"

# Email Address to send mail to? (user@domain.com)
MAILADDR="<your_email_address>”


#
#and thats its you are ready to go no cron nothing this will do the job automatically
#