LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   restore mysql backup (https://www.linuxquestions.org/questions/linux-software-2/restore-mysql-backup-519471/)

gabsik 01-15-2007 10:38 AM

restore mysql backup
 
I'm backing up a joomla site .Because it's the first time i do this what's the general procedure i have follow to restore the site on an another host,still debian.I'm backing up by a really nice script which is a mix of rsync , ssh , mysqldump and few more unix commands.
I have backups sorted by date from when the backup started up to current.My doubt is:it is an incremental backup so where is going to be the complete list of files?Do i have the overwrite all the directories in the backup folder ?
Quote:

2006-12-08_18:00 2006-12-19_06:00 2006-12-25_00:00 2006-12-30_18:00 2007-01-05_12:00 2007-01-11_06:00
2006-12-09_00:00 2006-12-19_12:00 2006-12-25_06:00 2006-12-31_00:00 2007-01-05_18:00 2007-01-11_12:00
2006-12-09_06:00 2006-12-19_18:00 2006-12-25_12:00 2006-12-31_06:00 2007-01-06_00:00 2007-01-11_18:00
2006-12-09_12:00 2006-12-20_00:00 2006-12-25_18:00 2006-12-31_12:00 2007-01-06_06:00 2007-01-12_00:00
2006-12-09_18:00 2006-12-20_06:00 2006-12-26_00:00 2006-12-31_18:00 2007-01-06_12:00 2007-01-12_12:00
2006-12-10_00:00 2006-12-20_12:00 2006-12-26_06:00 2007-01-01_00:00 2007-01-06_18:00 2007-01-12_18:00
2006-12-10_06:00 2006-12-20_18:00 2006-12-26_12:00 2007-01-01_06:00 2007-01-07_00:00 2007-01-13_00:00
2006-12-10_12:00 2006-12-21_00:00 2006-12-26_18:00 2007-01-01_12:00 2007-01-07_06:00 2007-01-13_06:00
2006-12-10_18:00 2006-12-21_06:00 2006-12-27_00:00 2007-01-01_18:00 2007-01-07_12:00 2007-01-13_12:00
2006-12-11_00:00 2006-12-21_12:00 2006-12-27_06:00 2007-01-02_00:00 2007-01-07_18:00 2007-01-13_18:00
2006-12-11_06:00 2006-12-21_18:00 2006-12-27_12:00 2007-01-02_06:00 2007-01-08_00:00 2007-01-14_00:00
2006-12-11_12:00 2006-12-22_00:00 2006-12-27_18:00 2007-01-02_12:00 2007-01-08_06:00 2007-01-14_06:00
2006-12-11_18:00 2006-12-22_06:00 2006-12-28_00:00 2007-01-02_18:00 2007-01-08_12:00 2007-01-14_12:00
2006-12-12_00:00 2006-12-22_12:00 2006-12-28_06:00 2007-01-03_00:00 2007-01-08_18:00 2007-01-14_18:00
2006-12-12_06:00 2006-12-22_18:00 2006-12-28_12:00 2007-01-03_06:00 2007-01-09_00:00 2007-01-15_00:00
2006-12-12_12:00 2006-12-23_00:00 2006-12-28_18:00 2007-01-03_12:00 2007-01-09_06:00 2007-01-15_06:00
2006-12-12_18:00 2006-12-23_06:00 2006-12-29_00:00 2007-01-03_18:00 2007-01-09_12:00 2007-01-15_12:00
2006-12-14_00:00 2006-12-23_12:00 2006-12-29_06:00 2007-01-04_00:00 2007-01-09_18:00 current
2006-12-16_00:50 2006-12-23_18:00 2006-12-29_12:00 2007-01-04_06:00 2007-01-10_00:00
2006-12-18_11:38 2006-12-24_00:00 2006-12-29_18:00 2007-01-04_12:00 2007-01-10_06:00
2006-12-18_12:00 2006-12-24_06:00 2006-12-30_00:00 2007-01-04_18:00 2007-01-10_12:00
2006-12-18_18:00 2006-12-24_12:00 2006-12-30_06:00 2007-01-05_00:00 2007-01-10_18:00
2006-12-19_00:00 2006-12-24_18:00 2006-12-30_12:00 2007-01-05_06:00 2007-01-11_00:00
From the command line how do i backup the database ?Which one is the complete one? sorry for the silly question but i can't afford to loose all he work on this site.thanks !
Quote:

root@www:~# ls /backup/current/
etc initrd.img.old mysql_backup swap var vmlinuz vmlinuz.old
root@www:~# ls /backup/current/mysql_backup/
Database.sql cilento.sql gabrix_mail_provider.sql mysql.sql snort.sql test.sql tor-final.sql tor-onion.sql

osdeals 01-15-2007 11:20 AM

Whoa! That's a pretty good collection of backups, but pretty much useless if you can't figure out which one to use.

You'll need to figure out which one contains your last FULL backup, restore that first using
mysql -u username (-h hostname) -p your_joomla_database_name < fullbackup.sql
Use the -h hostname only if you're connecting to a different mysql server from the machne where you execute this..

After you've done that, you'll need to restore each incremental in the same order in which they were taken.

Alternately, just take a fresh full backup with
mysqldump -u username (-h hostname) -p your_joomla_database_name > fullbackup.sql
and simply restore it with the command above.

Guttorm 01-15-2007 11:53 AM

Hi

Just wanna give another tip I learned from somoneone. If you have those files, and the server completely dies, it will probably take you a little while just to get another Debian server up with all the packages that you use.

In the backup script, add the line, e.g.
dpkg --get-selections >/etc/debian.packages.txt

The file "debian.packages.txt" now has a list of all packages on the system. If you need to set up a new server, set it up with just a base system, then do a:
dpkg --set-selections </etc/debian.packages.txt

Then start e.g. dselect, select install and you have the same stuff installed. I think this could be more useful than a backup of the kernel.

trickykid 01-15-2007 12:57 PM

Hate to burst your bubble but mysqldump doesn't do incremental backups, just full dumps, unless you've got some nifty script that is picking up just the changes from the binary logs that you had to enable in order to get incremental type backups running. If not, then you're latest dump would be the backup you'd want to reinsert into the new host mysql server, or depending on the size, disable your site and take a snapshot now to transfer over and bring the site up on it's new host.


All times are GMT -5. The time now is 03:51 PM.