mardi 21 juin 2016

How to download, unzip and import to mysql dump all via piping?

Is it possible to unzip a gzipped file while it's downloading and feed it to mysql all in one go without having to create a physical file?

So far I've been able to unzip and feed it to mysql using the following:-
gunzip < somefile.sql.gz | pv | mysql -u myself -p somedb #pv for viewing process

The above process expects the gzipped file to be downloaded already while unzipping and feeding it to mysql. But I haven't been able to feed to mysql while it's unzipping and downloading simultaneously.

And if this is not possible I'd like to know the why too so as to get a peace of mind.

Aucun commentaire:

Enregistrer un commentaire