Restoring a backup of Mysql.bz2?

I tried to do this, found this site: http://www.lullabot.com/blog/importexport-large-mysql-databases and am still confused why this does not work as it should. I am trying to restore a mysql.bz2 backup from one server to another using a database. The command I execute is:

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

I run this in a folder of two backup files:

 -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 get is simple: bunzip2: the output file SOB-MySQL-backup-summaries_live-2012-01-05.sql already exists.

I am not trying to dump anything, just restore the backup to the database. Maybe I'm wrong, but any help would be good. Thanks!

+4
source share
1 answer

The first command will decompress SOB-MySQL-backup-summaries_live-2012-01-05.sql.bz2 into SOB-MySQL-backup-summaries_live-2012-01-05.sql - and, apparently, this has already happened once.

From man bunzip2 (in your field or on the Internet, for example, 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 | You are looking for the following:

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

Source: https://habr.com/ru/post/1390254/


All Articles