While doing a MySQL dump is easy enough, I have a live dedicated MySQL server that I am wanting to setup replication on. To do this, I need dumps of the databases to import
Besides the already mentioned solution of using --single-transaction and --quick , I would not directly pipe the result in gzip but first dump it as a .sql file, and then gzip it. (Use && instead of | )
The dump itself will be faster so lower downtime. (for what I tested it was double as fast)
So I would go for "&& gzip" instead of "| gzip"
Important: check for free disk space first with df -h! since you will need more then piping | gzip.
mysqldump --single-transaction --quick -u user -p my_db_name > dump_name.sql && gzip dump_name.sql
-> which will also result in 1 file called dump_name.sql.gz