mysqldump from a remote server with compression
suggest changeTo compress the transfer, pass --compress. As of MySQL 8.0.18 that flag is deprecated; use --compression-algorithms=zlib on newer clients. Example:
mysqldump -h db.example.com -u username -p --compress dbname > dbname.sql
--lock-tables=false avoids a long read lock, but the dump can then mix old and new rows. For InnoDB, prefer --single-transaction --lock-tables=false, which uses one consistent snapshot. That does not make a consistent dump of MyISAM.
To also save the file compressed, you can pipe to gzip.
mysqldump -h db.example.com -u username -p --compress dbname | gzip --stdout > dbname.sql.gz
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents