Daniel
Daniel

Reputation: 73

Decompressing gz SQL file

So I want to decompress my something.gz file. Whenever I try to do this by using gunzip it ends after a little while saying there was an unexpected end of the file. The file itself is about 4gb.

Would appreciate any help regarding this problem.

Command: gunzip < db-20180518060048.sql.gz > db-20180518060048.sql

Response: gzip: stdin: unexpected end of file

Ends at: ('250

Upvotes: 7

Views: 18159

Answers (2)

David
David

Reputation: 111

As your file is quite big, it might be worth writing it to standard output and piping it directly into the database. You can do this with the following command:

gzip -c db-20180518060048.sql.gz | mysql (args..)

This can be done with gunzip also, I just use gzip as a personal preference. Use man gzip to get more detail on this command.

Upvotes: 2

tukan
tukan

Reputation: 17345

You have to use -d to decompress:

Your command would be:

gunzip -d db-20180518060048.sql.gz

Edit due to comment:

To test validity of your archive you can run

gunzip -t db-20180518060048.sql.gz

-t --test test compressed file integrity

The correct is only no output. Any other means that your archive is damaged.

Upvotes: 9

Related Questions