Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 280
jamadri Avatar asked Jan 10 '12 15:01

jamadri


People also ask

How do I restore a MySQL workbench backup?

Open MySQL Workbench and click Data Import/Restore in Navigator. In the Administration – Data Import/Restore document, select Import from the Self-Contained File and browse for the . sql file containing the backup of the sakila database.

How can I speed up a MySQL restore from a dump file?

Summary (for best dump restore performance):Set innodb_buffer_pool_size to half of RAM. Set innodb_log_file_size to 1G. Set innodb_flush_log_at_trx_commit to 0. Disabling innodb_double_write recommended only for fastest performance, it should be enabled on production.


1 Answers

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 e.g. 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...
like image 149
Piskvor left the building Avatar answered Sep 23 '22 02:09

Piskvor left the building