When using multiple replication channels, if a CHANGE REPLICATION SOURCE TO  statement does not name a channel using a FOR CHANNEL channel  clause, an error occurs. See Section 17.2.2, “Replication Channels”  for more information. 

Values used for SOURCE_HOST  and other CHANGE REPLICATION SOURCE TO  options are checked for linefeed ( 
  or 0x0A ) characters. The presence of such characters in these values causes the statement to fail with ER_MASTER_INFO . 

Invoking CHANGE REPLICATION SOURCE TO  causes the previous values for SOURCE_HOST , SOURCE_PORT , SOURCE_LOG_FILE , and SOURCE_LOG_POS  to be written to the error log, along with other information about the replica’s state prior to execution. 

CHANGE REPLICATION SOURCE TO  causes an implicit commit of an ongoing transaction. See Section 13.3.3, “Statements That Cause an Implicit Commit” . 

For some of the options of the CHANGE REPLICATION SOURCE TO  statement, you must issue a STOP REPLICA  statement prior to issuing a CHANGE REPLICATION SOURCE TO  statement (and a START REPLICA  statement afterwards). Sometimes, you only need to stop the replication SQL thread or the replication I/O thread, not both: 

•When the SQL thread is stopped, you can execute CHANGE REPLICATION SOURCE TO  using any combination that is otherwise allowed of RELAY_LOG_FILE , RELAY_LOG_POS , and SOURCE_DELAY options, even if the replication I/O thread is running. No other options may be used with this statement when the I/O thread is running. 

•When the I/O thread is stopped, you can execute CHANGE REPLICATION SOURCE TO  using any of the options for this statement (in any allowed combination) except RELAY_LOG_FILE , RELAY_LOG_POS , SOURCE_DELAY , or SOURCE_AUTO_POSITION = 1  even when the SQL thread is running. 

•Both the SQL thread and the I/O thread must be stopped before issuing a CHANGE REPLICATION SOURCE TO  statement that employs SOURCE_AUTO_POSITION = 1  or ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS . 

You can check the current state of the replication SQL thread and replication I/O thread using SHOW REPLICA STATUS . Note that the Group Replication applier channel ( group_replication_applier ) has no I/O thread, only an SQL thread. 

For more information, see Section 17.4.8, “Switching Sources During Failover” . 

If you are using statement-based replication and temporary tables, it is possible for a CHANGE REPLICATION SOURCE TO  statement following a STOP REPLICA  statement to leave behind temporary tables on the replica. A warning ( ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO ) is now issued whenever this occurs. You can avoid this in such cases by making sure that the value of the Slave_open_temp_tables  system status variable is equal to 0 prior to executing such a CHANGE REPLICATION SOURCE TO  statement. 

CHANGE REPLICATION SOURCE TO  is useful for setting up a replica when you have the snapshot of the source and have recorded the source’s binary log coordinates corresponding to the time of the snapshot. After loading the snapshot into the replica to synchronize it with the source, you can run CHANGE REPLICATION SOURCE TO SOURCE_LOG_FILE=’ log_name ’, SOURCE_LOG_POS= log_pos  on the replica to specify the coordinates at which the replica should begin reading the source’s binary log. 

The following example changes the source server the replica uses and establishes the source’s binary log coordinates from which the replica begins reading: 

CHANGE REPLICATION SOURCE TO SOURCE_HOST=’source2.example.com’, SOURCE_USER=’replication’, SOURCE_PASSWORD=’ password ’, 

