Kunaljain's Weblog

February 26, 2008

Automated backup script for Mysql

Filed under: MySql — Kunal Jain @ 17:41
Tags: , , ,

Open a file backup.sh and add the following lines in the file. Change UserName and Password with actual Username and Password.

/usr/local/mysql/bin/mysqldump --user=UserName --password=Password --lock-all-tables --all-databases | gzip > /home/user/backup/mysql/backup.sql.gz
cd /home/user/backup/mysql/
CURR=`date +%Y%m%d`
mv backup.sql.gz archives/backup.sql.gz.$CURR

This script create the file in archives folder in a gzip format.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: