Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Old 27th June 2006, 15:06
pontifex pontifex is offline
Join Date: Aug 2005
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default backup script for mysql server

Hi everyone,
i would likte to backup my complete mysql server on a regulär base to another server. is there a way to do that using rsync to save traffic?

every link is appreciated ;-)

Reply With Quote
Sponsored Links
Old 27th June 2006, 17:27
platd platd is offline
Join Date: Apr 2006
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts

Check out this script

I use it my self and it works great you can have the databases emailed to you and it backs upto a folder with date etc which you could then rsync or what ever to another machine as well

I use this one too for full backup which make restoring easy

/usr/local/bin/mysqldump -u root --password=password --all-databases | gzip > /usr/backups/fullmysql/backup.`date +%y%m
/usr/local/bin/mutt -s "Mysql Dump all db" -a /usr/backups/fullmysql/backup.`date +%y%m%d`.sql.gz emailme@domain.org.uk
< /root/text_foremail.txt

text_foremail.txt just contains some text that appears in the body of the email to remind me to do stuff.
I am not very good at scripting but it works ok
Reply With Quote
Old 27th June 2006, 18:35
sjau sjau is offline
Local Meanie
Join Date: Apr 2006
Location: Switzerland
Posts: 1,158
Thanks: 4
Thanked 58 Times in 54 Posts

If you use rsync or rdiff or whaterver to put files on a remote server I suggest this here:

# Make MySQL Backups
# Remove old files
rm -f /mysql_backup/*

#Dump new files

for i in $(echo 'SHOW DATABASES;' | mysql -u$USER -p$PASSWORD -h$HOST|grep -v '^Database$'); do
mysqldump \
-Q -c -C --add-drop-table --add-locks --quick --lock-tables \
$i > /mysql_backup/$i.sql;
this one will create individual backup files for each database. I prefer this over having one huge file....
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
php Apps email not going through palkat General 8 21st September 2011 06:35
Statistic not working mzo Installation/Configuration 49 20th April 2011 13:19
Backup routine for ISPConfig-equipped server IntnsRed General 4 5th May 2006 18:29
Email - Ueb-Miau mazhar Installation/Configuration 5 21st December 2005 11:01
The Perfect Setup Suse 9.3 - Postfix problems new_bee05 HOWTO-Related Questions 20 25th November 2005 03:30

All times are GMT +2. The time now is 10:03.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.