Using gzip compression with mysqldump

Can someone provide an example of how I can include the path to my zip compression software in the following PHP code? The code works when dumping into a simple sql file, however gzip compression obviously relies on including the correct path.

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

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

You are missing the option -cfor gzip, which tells it the output to standard output. Otherwise, it will work with files.

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

+5
source

All Articles