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.
Reply
 
Thread Tools Display Modes
  #1  
Old 27th June 2006, 14:06
pontifex pontifex is offline
Member
 
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 ;-)

Cheers
PM
Reply With Quote
Sponsored Links
  #2  
Old 27th June 2006, 16:27
platd platd is offline
Member
 
Join Date: Apr 2006
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Check out this script
http://kent.dl.sourceforge.net/sourc...lbackup.sh.2.5

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

#!/bin/sh
/usr/local/bin/mysqldump -u root --password=password --all-databases | gzip > /usr/backups/fullmysql/backup.`date +%y%m
%d`.sql.gz
/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
  #3  
Old 27th June 2006, 17:35
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,146
Thanks: 4
Thanked 55 Times in 51 Posts
 
Default

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

Code:
# Make MySQL Backups
#!/bin/bash
# Remove old files
rm -f /mysql_backup/*

#Dump new files
USER=root
PASSWORD=************
HOST=localhost

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

Bookmarks

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 05:35
Statistic not working mzo Installation/Configuration 49 20th April 2011 12:19
Backup routine for ISPConfig-equipped server IntnsRed General 4 5th May 2006 17:29
Email - Ueb-Miau mazhar Installation/Configuration 5 21st December 2005 10:01
The Perfect Setup Suse 9.3 - Postfix problems new_bee05 HOWTO-Related Questions 20 25th November 2005 02:30


All times are GMT +2. The time now is 02:53.


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