我如何gzip mysqldump的结果文件? [英] how can i gzip the result file of mysqldump?

查看:102
本文介绍了我如何gzip mysqldump的结果文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我希望将mysqldump的结果压缩成gzip,就像从phpMyAdmin中将其提取为gz文件一样.

我使用了以下命令:
mysqldump --add-drop-database = true -u用户名-ppassword -hlocalhost-数据库myDB | gzip> mysql.gz

但它不起作用.无法提取导致错误的结果文件:

---------------------------
错误
---------------------------
C:\ mysql.gz
档案格式不明或已损坏
---------------------------
OK
---------------------------


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
---------------------------

推荐答案

在之间插入-" gzip和重定向:
Insert a "-" between gzip and the redirect:
mysqldump --add-drop-database=true -uusername -ppassword -hlocalhost --databases myDB | gzip - > mysql.gz



-"告诉gzip从stdin中读取.



The "-" tells gzip to read from stdin.


这篇关于我如何gzip mysqldump的结果文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆