简体   繁体   English

使用gzip压缩与mysqldump

[英]Using gzip compression with mysqldump

Can anyone provide an example of how I can include a path to my zip compression software within the following php code? 任何人都可以提供一个示例,说明如何在以下php代码中包含我的zip压缩软件的路径? The code works when dumping into a simple sql file, however, gzip compression obviously relies on including the correct path. 转码到一个简单的sql文件时代码工作,但是,gzip压缩显然依赖于包含正确的路径。

$dumpfile = $dbname . ".sql.gz"; 

passthru("c:\\xampp\\mysql\\bin\\mysqldump.exe --opt --host=$dbhost --user=$dbuser --password=$dbpwd $dbname | gzip -v -9 > $dumpfile");  

You are missing the -c option to gzip that tells it to output to standard output. 你缺少gzip的-c选项,告诉它输出到标准输出。 Otherwise it expects to operate on files. 否则它希望对文件进行操作。

use ... | gzip -9 -c > $dumpfile ... | gzip -9 -c > $dumpfile ... | gzip -9 -c > $dumpfile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM