mysqldump — A Database Backup Program Replication Options The  mysqldump  command is frequently used to create an empty instance, or an instance including data, on a replica server in a replication configuration. The following options apply to dumping and restoring data on replication source servers and replicas. For a replica dump produced with the  --dump-slave  option, add a  STOP REPLICA | SLAVE statement before the statement with the binary log coordinates, and a  START REPLICA | SLAVE statement at the end of the output. On a replication source server, delete the binary logs by sending a  PURGE BINARY LOGS  statement to the server after performing the dump operation. This option requires the  RELOAD  privilege as well as privileges sufficient to execute that statement. This option automatically enables  --master-data . This option is similar to  --master-data  except that it is used to dump a replica server to produce a dump file that can be used to set up another server as a replica that has the same source as the dumped server. It causes the dump output to include a  CHANGE REPLICATION SOURCE TO  statement (from MySQL 8.0.23) or  CHANGE MASTER TO  statement (before MySQL 8.0.23) that indicates the binary log coordinates (file name and position) of the dumped replica’s source. The  CHANGE REPLICATION SOURCE TO  statement reads the values of  Relay_Master_Log_File  and  Exec_Master_Log_Pos from the  SHOW REPLICA | SLAVE STATUS  output and uses them for  SOURCE_LOG_FILE  and SOURCE_LOG_POS  respectively. These are the replication source server coordinates from which the replica starts replicating. Inconsistencies in the sequence of transactions from the relay log which have been executed can cause the wrong position to be used. See Section 17.5.1.34, “Replication and Transaction Inconsistencies”  for more information. --dump-slave  causes the coordinates from the source to be used rather than those of the dumped server, as is done by the  --master-data  option. In addition, specifiying this option causes the  -- master-data  option to be overridden, if used, and effectively ignored. This option should not be used if the server where the dump is going to be applied uses  gtid_mode=ON  and  MASTER_AUTOPOSITION=1 . The option value is handled the same way as for  --master-data . Setting no value or 1 causes a  CHANGE REPLICATION SOURCE TO  statement (from MySQL 8.0.23) or  CHANGE MASTER TO statement (before MySQL 8.0.23) to be written to the dump. Setting 2 causes the statement to be written but encased in SQL comments. It has the same effect as  --master-data  in terms of enabling or disabling other options and in how locking is handled. This option causes  mysqldump  to stop the replication SQL thread before the dump and restart it again after. --dump-slave  sends a  SHOW REPLICA | SLAVE STATUS  statement to the server to obtain information, so it requires privileges sufficient to execute that statement. 489 Note Warning • --apply-slave-statements • --delete-master-logs • --dump-slave[= value ]