简体   繁体   中英

Restoring a .bz2 Mysql Backup?

I've tried doing my research on this, found this website: http://www.lullabot.com/blog/importexport-large-mysql-databases and still am confused as to why this isn't working like it should. I'm trying to restore a mysql .bz2 backup from one server to another with the database. The command I'm running to do so is:

 bunzip2 SOB-MySQL-backup-summaries_live-2012-01-05.sql.bz2 | mysql -h 192.168.255.53 -u sobuser -p summaries_criticaltest

I'm running this in a folder of 2 backup files being:

-rw-r--r--  1 root root 19339638 Jan  5 13:50 SOB-MySQL-backup-summaries_dev-2012-01-05.sql.bz2
-rw-r--r--  1 root root      453 Jan 10 09:45 SOB-MySQL-backup-summaries_live-2012-01-05.sql.bz2

The output I'm getting is just this: bunzip2: Output file SOB-MySQL-backup-summaries_live-2012-01-05.sql already exists.

I'm not trying to dump anything, just restore the backup zip to the database. I may be doing this all wrong but any help would be good. Thanks!

The first command will decompress SOB-MySQL-backup-summaries_live-2012-01-05.sql.bz2 to SOB-MySQL-backup-summaries_live-2012-01-05.sql - and apparently that already happened once.

From man bunzip2 (at your box, or online eg at http://www.manpagez.com/man/1/bzip2/ ):

 You  can  also  compress  or decompress files to the standard output by
   giving the -c flag.

So, in the part before the | , you're looking for this:

bunzip2 -c SOB-MySQL-backup-summaries_live-2012-01-05.sql.bz2 | ...etc...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM