1
I have a gzipped database backup stored on S3 and would like to restore it to MySql without having to first download it due to disk space constraints. I tried the two commands below but got gzip: stdin: not in gzip format
both times.
Version 1:
s3cmd get s3://mybucket/mydbbackup.sql.gz | gzip -d | mysql -u root -p
Version 2:
s3cmd get s3://mybucket/mydbbackup.sql.gz - | gzip -d | mysql -u root -p
Pipe it directly into less or something. Do you see something that looks like a mysqldump? What happens if you do
s3cmd get s3://mybucket/mydbbackup.sql.gz - | od -x
? – Zoredache – 2016-03-09T22:27:12.063I get a lot of hex output
0000000 7327 3a33 2f2f 6877 7265 7465 626f 7975
. What should I be looking for? – KalenGi – 2016-03-09T22:37:08.910the
s3cmd ... | od -x
was just to double check you were getting anything at all, and not an error or something, anyway if that gives you something see what you get with your command line, without the pipe into mysql. Sos3cmd get s3://mybucket/mydbbackup.sql.gz - | gzip -d
What you see should look like a bunch of SQL statements. – Zoredache – 2016-03-10T00:06:06.127Even this gives me the same error
s3cmd get s3://mybucket/mydbbackup.sql.gz - | zcat
– KalenGi – 2016-03-10T00:42:17.630Hrm, I am running low on ideas. How exactly did you make this backup? – Zoredache – 2016-03-10T17:36:41.063
I think the
s3cmd
output is corrupt. The restore worked when I switched tocurl
– KalenGi – 2016-03-11T16:26:54.683