mysqlgzip

mysqldump + gzip making 0 bytes gz file


I have installed gnu gzip on windows along with MariaDB, i'm trying to run this command

mysqldump -uroot -proot db_name > "DATABASE-2020-01-19-16-53-30.sql" | gzip > "DATABASE-2020-01-19-16-53-30.sql.gz"

What i'm getting is two files of the actual sql file and the compressed file:

enter image description here

the zipped file is 1kb having a the sql file of 0 bytes.

What i noticed is that when i run the command it stalls until it finishes creating the dump file, at first when i run this command i get two files instantly of 0 bytes, then after a second the dump file becomes 50mb but the zipped file becomes 20bytes with the dump file of 0 byte, so i guess that the gzip command isn't actively watching the zip, or getting and error reading the final sql file.

i tried many variations of gzip -f -v SOURCE > DESTINATION.gz, but nothing made it happen.

I tested that on centos as well, same MariaDB + php version,

I'm running WampServer 3.2.0 with MariaDB 10.4 and PHP 7.3.12 on Windows 10.

It works when i input a different file into gzip after ther pipe for example robots.txt, the zipped becomes an archive with robots.txt in it. mysqldump.... | gzip robots.txt > archive.gz

What did i miss ? and thank you for your time.


Solution

  • You have a double output direct

    Command should be

    mysqldump -uroot -proot db_name | gzip > "DATABASE-2020-01-19-16-53-30.sql.gz"