Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i want the result of mysqldump to be gzipped like extracting it as gz file from phpMyAdmin.

i used the following command:
mysqldump --add-drop-database=true -uusername -ppassword -hlocalhost --databases myDB | gzip > mysql.gz

but it does not work. the resulted file can not be extracted for the error:

---------------------------
Error
---------------------------
C:\mysql.gz
The archive is either in unknown format or damaged
---------------------------
OK
---------------------------
Posted

1 solution

Insert a "-" between gzip and the redirect:
mysqldump --add-drop-database=true -uusername -ppassword -hlocalhost --databases myDB | gzip - > mysql.gz


The "-" tells gzip to read from stdin.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900