mysqldump — A Database Backup Program In conjunction with  --dump-slave , the  --apply-slave-statements  and  --include-master- host-port  options can also be used. For the  CHANGE REPLICATION SOURCE TO  statement (from MySQL 8.0.23) or  CHANGE MASTER TO  statement (before MySQL 8.0.23) in a replica dump produced with the  --dump-slave  option, add SOURCE_HOST  |  MASTER_HOST  and  SOURCE_PORT  |  MASTER_PORT  options for the host name and TCP/ IP port number of the replica’s source. Use this option to dump a replication source server to produce a dump file that can be used to set up another server as a replica of the source. 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 server. These are the replication source server coordinates from which the replica should start replicating after you load the dump file into the replica. If the option value is 2, the  CHANGE REPLICATION SOURCE TO  |  CHANGE MASTER TO  statement is written as an SQL comment, and thus is informative only; it has no effect when the dump file is reloaded. If the option value is 1, the statement is not written as a comment and takes effect when the dump file is reloaded. If no option value is specified, the default value is 1. --master-data  sends a  SHOW MASTER STATUS  statement to the server to obtain information, so it requires privileges sufficient to execute that statement. This option also requires the  RELOAD  privilege and the binary log must be enabled. The  --master-data  option automatically turns off  --lock-tables . It also turns on  --lock- all-tables , unless  --single-transaction  also is specified, in which case, a global read lock is acquired only for a short time at the beginning of the dump (see the description for  --single- transaction ). In all cases, any action on logs happens at the exact moment of the dump. It is also possible to set up a replica by dumping an existing replica of the source, using the  --dump- slave  option, which overrides  --master-data  and causes it to be ignored if both options are used. This option is for servers that use GTID-based replication ( gtid_mode=ON ). It controls the inclusion of a  SET @@GLOBAL.gtid_purged  statement in the dump output, which updates the value of gtid_purged  on a server where the dump file is reloaded, to add the GTID set from the source server’s gtid_executed  system variable.  gtid_purged  holds the GTIDs of all transactions that have been applied on the server, but do not exist on any binary log file on the server.  mysqldump  therefore adds the GTIDs for the transactions that were executed on the source server, so that the target server records these transactions as applied, although it does not have them in its binary logs.  --set-gtid-purged also controls the inclusion of a  SET @@SESSION.sql_log_bin=0  statement, which disables binary logging while the dump file is being reloaded. This statement prevents new GTIDs from being generated and assigned to the transactions in the dump file as they are executed, so that the original GTIDs for the transactions are used. If you do not set the  --set-gtid-purged  option, the default is that a  SET @@GLOBAL.gtid_purged statement is included in the dump output if GTIDs are enabled on the server you are backing up, and • --set-gtid-purged= value • --master-data[= value ] • --include-master-host-port 490