I have a .gz sql dump file (example: foo.sql.gz) that i want import in my database with the classic mysql command.
gunzip -c foo.sql.gz > foo.sql
mysql -uroot -ppassword foo < foo.sql
foo is the database.
How can i pipe these two commands in a single one?
Tried
gunzip -c foo.sql.gz | mysql -uroot -ppassword foo
but doesn't seem to work; i get gzip: stdout: Broken pipe
Answer
zcat foo.sql.gz | mysql -uroot -ppassword foo
This will also leave foo.sql.gz
as it is.
No comments:
Post a Comment