<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="change-replication-source-to">
      </a>
      15.4.2.2 CHANGE REPLICATION SOURCE TO Statement
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045177656384">
  </a>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa91303097"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CHANGE</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span> <span class="token keyword"><em class="replaceable">option</em></span> <span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token keyword"><em class="replaceable">option</em></span><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token punctuation">[</span> <em class="replaceable">channel_option</em> <span class="token punctuation">]</span>

<span class="token keyword"><em class="replaceable">option</em></span>: {
    <span class="token keyword">SOURCE_BIND</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">interface_name</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_HOST</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">host_name</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_USER</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">user_name</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_PASSWORD</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">password</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_PORT</span> <span class="token operator">=</span> <em class="replaceable">port_num</em>
  <span class="token operator">|</span> <span class="token keyword">PRIVILEGE_CHECKS_USER</span> <span class="token operator">=</span> {<span class="token boolean">NULL</span> <span class="token operator">|</span> <span class="token string">'<em class="replaceable">account</em>'</span>}
  <span class="token operator">|</span> <span class="token keyword">REQUIRE_ROW_FORMAT</span> <span class="token operator">=</span> {<span class="token number">0</span><span class="token operator">|</span><span class="token number">1</span>}
  <span class="token operator">|</span> <span class="token keyword">REQUIRE_TABLE_PRIMARY_KEY_CHECK</span> <span class="token operator">=</span> {<span class="token keyword">STREAM</span> <span class="token operator">|</span> <span class="token keyword">ON</span> <span class="token operator">|</span> <span class="token keyword">OFF</span> <span class="token operator">|</span> GENERATE}
  <span class="token operator">|</span> <span class="token keyword">ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS</span> <span class="token operator">=</span> {<span class="token keyword">OFF</span> <span class="token operator">|</span> <span class="token keyword">LOCAL</span> <span class="token operator">|</span> <em class="replaceable">uuid</em>}
  <span class="token operator">|</span> <span class="token keyword">SOURCE_LOG_FILE</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">source_log_name</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_LOG_POS</span> <span class="token operator">=</span> <span class="token keyword"><em class="replaceable">source_log_pos</em></span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_AUTO_POSITION</span> <span class="token operator">=</span> {<span class="token number">0</span><span class="token operator">|</span><span class="token number">1</span>}
  <span class="token operator">|</span> <span class="token keyword">RELAY_LOG_FILE</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">relay_log_name</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">RELAY_LOG_POS</span> <span class="token operator">=</span> <span class="token keyword"><em class="replaceable">relay_log_pos</em></span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_HEARTBEAT_PERIOD</span> <span class="token operator">=</span> <span class="token keyword"><em class="replaceable">interval</em></span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_CONNECT_RETRY</span> <span class="token operator">=</span> <span class="token keyword"><em class="replaceable">interval</em></span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_RETRY_COUNT</span> <span class="token operator">=</span> <em class="replaceable">count</em>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_CONNECTION_AUTO_FAILOVER</span> <span class="token operator">=</span> {<span class="token number">0</span><span class="token operator">|</span><span class="token number">1</span>}
  <span class="token operator">|</span> <span class="token keyword">SOURCE_DELAY</span> <span class="token operator">=</span> <span class="token keyword"><em class="replaceable">interval</em></span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_COMPRESSION_ALGORITHMS</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">algorithm</em>[,<em class="replaceable">algorithm</em>][,<em class="replaceable">algorithm</em>]'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_ZSTD_COMPRESSION_LEVEL</span> <span class="token operator">=</span> <span class="token keyword"><em class="replaceable">level</em></span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_SSL</span> <span class="token operator">=</span> {<span class="token number">0</span><span class="token operator">|</span><span class="token number">1</span>}
  <span class="token operator">|</span> <span class="token keyword">SOURCE_SSL_CA</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">ca_file_name</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_SSL_CAPATH</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">ca_directory_name</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_SSL_CERT</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">cert_file_name</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_SSL_CRL</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">crl_file_name</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_SSL_CRLPATH</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">crl_directory_name</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_SSL_KEY</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">key_file_name</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_SSL_CIPHER</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">cipher_list</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_SSL_VERIFY_SERVER_CERT</span> <span class="token operator">=</span> {<span class="token number">0</span><span class="token operator">|</span><span class="token number">1</span>}
  <span class="token operator">|</span> <span class="token keyword">SOURCE_TLS_VERSION</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">protocol_list</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_TLS_CIPHERSUITES</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">ciphersuite_list</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">SOURCE_PUBLIC_KEY_PATH</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">key_file_name</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">GET_SOURCE_PUBLIC_KEY</span> <span class="token operator">=</span> {<span class="token number">0</span><span class="token operator">|</span><span class="token number">1</span>}
  <span class="token operator">|</span> <span class="token keyword">NETWORK_NAMESPACE</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">namespace</em>'</span>
  <span class="token operator">|</span> <span class="token keyword">IGNORE_SERVER_IDS</span> <span class="token operator">=</span> <span class="token punctuation">(</span><em class="replaceable">server_id_list</em><span class="token punctuation">)</span><span class="token punctuation">,</span>
  <span class="token operator">|</span> <span class="token keyword">GTID_ONLY</span> <span class="token operator">=</span> {<span class="token number">0</span><span class="token operator">|</span><span class="token number">1</span>}
}

<em class="replaceable">channel_option</em>:
    <span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token keyword"><em class="replaceable">channel</em></span>

<em class="replaceable">server_id_list</em>:
    <span class="token punctuation">[</span><em class="replaceable">server_id</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">server_id</em><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token punctuation">]</span></code></pre>
  </div>
  <p>
   <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
    <code class="literal">
     CHANGE REPLICATION SOURCE TO
    </code>
   </a>
   changes the parameters that the replica server uses for
        connecting to the source and reading data from the source. It
        also updates the contents of the replication metadata
        repositories (see
   <a class="xref" href="replica-logs.html" title="19.2.4 Relay Log and Replication Metadata Repositories">
    Section 19.2.4, “Relay Log and Replication Metadata Repositories”
   </a>
   ).
  </p>
  <p>
   <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
    <code class="literal">
     CHANGE REPLICATION SOURCE TO
    </code>
   </a>
   requires the
   <a class="link" href="privileges-provided.html#priv_replication-slave-admin">
    <code class="literal">
     REPLICATION_SLAVE_ADMIN
    </code>
   </a>
   privilege
        (or the deprecated
   <a class="link" href="privileges-provided.html#priv_super">
    <code class="literal">
     SUPER
    </code>
   </a>
   privilege).
  </p>
  <p>
   Options that you do not specify on a
   <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
    <code class="literal">
     CHANGE
        REPLICATION SOURCE TO
    </code>
   </a>
   statement retain their value,
        except as indicated in the following discussion. In most cases,
        there is therefore no need to specify options that do not
        change.
  </p>
  <p>
   Values used for
   <code class="literal">
    SOURCE_HOST
   </code>
   and other
   <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
    <code class="literal">
     CHANGE REPLICATION SOURCE TO
    </code>
   </a>
   options are checked for linefeed (
   <code class="literal">
    \n
   </code>
   or
   <code class="literal">
    0x0A
   </code>
   ) characters. The presence of such
        characters in these values causes the statement to fail with an
        error.
  </p>
  <p>
   The optional
   <code class="literal">
    FOR CHANNEL
    <em class="replaceable">
     <code>
      channel
     </code>
    </em>
   </code>
   clause lets you
        name which replication channel the statement applies to.
        Providing a
   <code class="literal">
    FOR CHANNEL
    <em class="replaceable">
     <code>
      channel
     </code>
    </em>
   </code>
   clause applies the
   <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
    <code class="literal">
     CHANGE REPLICATION SOURCE TO
    </code>
   </a>
   statement to a specific replication channel, and is used to add
        a new channel or modify an existing channel. For example, to add
        a new channel called
   <code class="literal">
    channel2
   </code>
   :
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa5690360"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CHANGE</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span> <span class="token keyword">SOURCE_HOST</span><span class="token operator">=</span>host1<span class="token punctuation">,</span> <span class="token keyword">SOURCE_PORT</span><span class="token operator">=</span><span class="token number">3002</span> <span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">'channel2'</span><span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   If no clause is named and no extra channels exist, a
   <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
    <code class="literal">
     CHANGE REPLICATION SOURCE TO
    </code>
   </a>
   statement applies to the default channel, whose name is the
        empty string (""). When you have set up multiple replication
        channels, every
   <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
    <code class="literal">
     CHANGE REPLICATION SOURCE
        TO
    </code>
   </a>
   statement must name a channel using the
   <code class="literal">
    FOR CHANNEL
    <em class="replaceable">
     <code>
      channel
     </code>
    </em>
   </code>
   clause. See
   <a class="xref" href="replication-channels.html" title="19.2.2 Replication Channels">
    Section 19.2.2, “Replication Channels”
   </a>
   for more information.
  </p>
  <p>
   For some of the options of the
   <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
    <code class="literal">
     CHANGE
        REPLICATION SOURCE TO
    </code>
   </a>
   statement, you must issue a
   <a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
    <code class="literal">
     STOP REPLICA
    </code>
   </a>
   statement prior to
        issuing a
   <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
    <code class="literal">
     CHANGE REPLICATION SOURCE
        TO
    </code>
   </a>
   statement (and a
   <a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
    <code class="literal">
     START
        REPLICA
    </code>
   </a>
   statement afterwards). Sometimes, you only
        need to stop the replication SQL (applier) thread or the
        replication I/O (receiver) thread, not both:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      When the applier thread is stopped, you can execute
      <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
       <code class="literal">
        CHANGE REPLICATION SOURCE TO
       </code>
      </a>
      using any combination that is otherwise allowed of
      <code class="literal">
       RELAY_LOG_FILE
      </code>
      ,
      <code class="literal">
       RELAY_LOG_POS
      </code>
      , and
      <code class="literal">
       SOURCE_DELAY
      </code>
      options, even if the
            replication receiver thread is running. No other options may
            be used with this statement when the receiver thread is
            running.
     </p>
    </li>
    <li class="listitem">
     <p>
      When the receiver thread is stopped, you can execute
      <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
       <code class="literal">
        CHANGE REPLICATION SOURCE TO
       </code>
      </a>
      using any of the options for this statement (in any allowed
            combination)
      <span class="emphasis">
       <em>
        except
       </em>
      </span>
      <code class="literal">
       RELAY_LOG_FILE
      </code>
      ,
      <code class="literal">
       RELAY_LOG_POS
      </code>
      ,
      <code class="literal">
       SOURCE_DELAY
      </code>
      , or
      <code class="literal">
       SOURCE_AUTO_POSITION = 1
      </code>
      even when the
            applier thread is running.
     </p>
    </li>
    <li class="listitem">
     <p>
      Both the receiver thread and the applier thread must be
            stopped before issuing a
      <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
       <code class="literal">
        CHANGE
            REPLICATION SOURCE TO
       </code>
      </a>
      statement that employs
      <code class="literal">
       SOURCE_AUTO_POSITION = 1
      </code>
      ,
      <code class="literal">
       GTID_ONLY = 1
      </code>
      , or
      <code class="literal">
       ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS
      </code>
      .
     </p>
    </li>
   </ul>
  </div>
  <p>
   You can check the current state of the replication applier
        thread and replication receiver thread using
   <a class="link" href="show-replica-status.html" title="15.7.7.35 SHOW REPLICA STATUS Statement">
    <code class="literal">
     SHOW
        REPLICA STATUS
    </code>
   </a>
   . Note that the Group Replication
        applier channel (
   <code class="literal">
    group_replication_applier
   </code>
   )
        has no receiver thread, only an applier thread.
  </p>
  <p>
   <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
    <code class="literal">
     CHANGE REPLICATION SOURCE TO
    </code>
   </a>
   statements have a number of side-effects and interactions that
        you should be aware of beforehand:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
       <code class="literal">
        CHANGE REPLICATION SOURCE TO
       </code>
      </a>
      causes an implicit commit of an ongoing transaction. See
      <a class="xref" href="implicit-commit.html" title="15.3.3 Statements That Cause an Implicit Commit">
       Section 15.3.3, “Statements That Cause an Implicit Commit”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
       <code class="literal">
        CHANGE REPLICATION SOURCE TO
       </code>
      </a>
      causes the previous values for
      <code class="literal">
       SOURCE_HOST
      </code>
      ,
      <code class="literal">
       SOURCE_PORT
      </code>
      ,
      <code class="literal">
       SOURCE_LOG_FILE
      </code>
      , and
      <code class="literal">
       SOURCE_LOG_POS
      </code>
      to be written to the error
            log, along with other information about the replica's
            state prior to execution.
     </p>
    </li>
    <li class="listitem">
     <p>
      If you are using statement-based replication and temporary
            tables, it is possible for a
      <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
       <code class="literal">
        CHANGE
            REPLICATION SOURCE TO
       </code>
      </a>
      statement following a
      <a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
       <code class="literal">
        STOP
            REPLICA
       </code>
      </a>
      statement to leave behind temporary tables
            on the replica. A warning
            (
      <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_warn_open_temp_tables_must_be_zero" target="_top">
       <code class="literal">
        ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO
       </code>
      </a>
      )
            is issued whenever this occurs. You can avoid this in such
            cases by making sure that the value of the
      <a class="link" href="server-status-variables.html#statvar_Replica_open_temp_tables">
       <code class="literal">
        Replica_open_temp_tables
       </code>
      </a>
      system status variable is equal to 0 prior to executing such
            a
      <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
       <code class="literal">
        CHANGE REPLICATION SOURCE
            TO
       </code>
      </a>
      statement.
     </p>
    </li>
    <li class="listitem">
     <p>
      When using a multithreaded replica
            (
      <a class="link" href="replication-options-replica.html#sysvar_replica_parallel_workers">
       <code class="literal">
        replica_parallel_workers
       </code>
      </a>
      &gt; 0), stopping the replica can cause gaps in the sequence
            of transactions that have been executed from the relay log,
            regardless of whether the replica was stopped intentionally
            or otherwise. In MySQL 8.4, these can be
            resolved using GTID auto-positioning.
     </p>
    </li>
   </ul>
  </div>
  <p>
   The following options are available for
   <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
    <code class="literal">
     CHANGE REPLICATION SOURCE TO
    </code>
   </a>
   statements:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a name="crs-opt-assign_gtids_to_anonymous_transactions">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-assign_gtids_to_anonymous_transactions">
       <code class="literal">
        ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS
            = {OFF | LOCAL |
        <em class="replaceable">
         <code>
          uuid
         </code>
        </em>
        }
       </code>
      </a>
     </p>
     <p>
      Makes the replication channel assign a GTID to replicated
            transactions that do not have one, enabling replication from
            a source that does not use GTID-based replication, to a
            replica that does. For a multi-source replica, you can have
            a mix of channels that use
      <code class="literal">
       ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS
      </code>
      ,
            and channels that do not. The default is
      <code class="literal">
       OFF
      </code>
      , meaning that the feature is not
            used.
     </p>
     <p>
      <code class="literal">
       LOCAL
      </code>
      assigns a GTID including the
            replica's own UUID (the
      <a class="link" href="replication-options.html#sysvar_server_uuid">
       <code class="literal">
        server_uuid
       </code>
      </a>
      setting).
      <code class="literal">
       <em class="replaceable">
        <code>
         uuid
        </code>
       </em>
      </code>
      assigns a
            GTID including the specified UUID, such as the
      <a class="link" href="replication-options.html#sysvar_server_uuid">
       <code class="literal">
        server_uuid
       </code>
      </a>
      setting for the
            replication source server. Using a nonlocal UUID lets you
            differentiate between transactions that originated on the
            replica and transactions that originated on the source, and
            for a multi-source replica, between transactions that
            originated on different sources. The UUID you choose only
            has significance for the replica's own use. If any of the
            transactions sent by the source do have a GTID already, that
            GTID is retained.
     </p>
     <p>
      Channels specific to Group Replication cannot use
      <code class="literal">
       ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS
      </code>
      ,
            but an asynchronous replication channel for another source
            on a server instance that is a Group Replication group
            member can do so. In that case, do not specify the Group
            Replication group name as the UUID for creating the GTIDs.
     </p>
     <p>
      To set
      <code class="literal">
       ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS
      </code>
      to
      <code class="literal">
       LOCAL
      </code>
      or
      <code class="literal">
       <em class="replaceable">
        <code>
         uuid
        </code>
       </em>
      </code>
      , the
            replica must have
      <a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
       <code class="literal">
        gtid_mode=ON
       </code>
      </a>
      set, and this
            cannot be changed afterwards. This option is for use with a
            source that has binary log file position based replication,
            so
      <code class="literal">
       SOURCE_AUTO_POSITION=1
      </code>
      cannot be set
            for the channel. Both the replication SQL thread and the
            replication I/O (receiver) thread must be stopped before
            setting this option.
     </p>
     <div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Important
      </div>
      <p>
       A replica set up with
       <code class="literal">
        ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS
       </code>
       on any channel cannot be promoted to replace the
              replication source server in the event that a failover is
              required, and a backup taken from the replica cannot be
              used to restore the replication source server. The same
              restriction applies to replacing or restoring other
              replicas that use
       <code class="literal">
        ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS
       </code>
       on any channel.
      </p>
     </div>
     <p>
      For further restrictions and information, see
      <a class="xref" href="replication-gtids-assign-anon.html" title="19.1.3.6 Replication From a Source Without GTIDs to a Replica With GTIDs">
       Section 19.1.3.6, “Replication From a Source Without GTIDs to a Replica With GTIDs”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-get_source_public_key">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-get_source_public_key">
       <code class="literal">
        GET_SOURCE_PUBLIC_KEY =
            {0|1}
       </code>
      </a>
     </p>
     <p>
      Enables RSA key pair-based password exchange by requesting
            the public key from the source. The option is disabled by
            default.
     </p>
     <p>
      This option applies to replicas that authenticate with the
      <code class="literal">
       caching_sha2_password
      </code>
      authentication
            plugin. For connections by accounts that authenticate using
            this plugin, the source does not send the public key unless
            requested, so it must be requested or specified in the
            client. If
      <code class="literal">
       SOURCE_PUBLIC_KEY_PATH
      </code>
      is
            given and specifies a valid public key file, it takes
            precedence over
      <code class="literal">
       GET_SOURCE_PUBLIC_KEY
      </code>
      . If
            you are using a replication user account that authenticates
            with the
      <code class="literal">
       caching_sha2_password
      </code>
      plugin
            (the default), and you are not using a secure connection,
            you must specify either this option or the
      <code class="literal">
       SOURCE_PUBLIC_KEY_PATH
      </code>
      option to provide
            the RSA public key to the replica.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-gtid_only">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-gtid_only">
       <code class="literal">
        GTID_ONLY = {0|1}
       </code>
      </a>
     </p>
     <p>
      Stops the replication channel persisting file names and file
            positions in the replication metadata repositories.
      <code class="literal">
       GTID_ONLY
      </code>
      is disabled by default for
            asynchronous replication channels, but is enabled by default
            for Group Replication channels, for which it cannot be
            disabled.
     </p>
     <p>
      For replication channels with this setting, in-memory file
            positions are still tracked, and file positions can still be
            observed for debugging purposes in error messages and
            through interfaces such as
      <a class="link" href="show-replica-status.html" title="15.7.7.35 SHOW REPLICA STATUS Statement">
       <code class="literal">
        SHOW REPLICA
            STATUS
       </code>
      </a>
      statements (where they are shown as being
            invalid if they are out of date). However, the writes and
            reads required to persist and check the file positions are
            avoided in situations where GTID-based replication does not
            actually require them, including the transaction queuing and
            application process.
     </p>
     <p>
      This option can be used only if both the replication SQL
            (applier) thread and replication I/O (receiver) thread are
            stopped. To set
      <code class="literal">
       GTID_ONLY = 1
      </code>
      for a
            replication channel, GTIDs must be in use on the server
            (
      <a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
       <code class="literal">
        gtid_mode = ON
       </code>
      </a>
      ), and
            row-based binary logging must be in use on the source
            (statement-based replication is not supported). The options
      <code class="literal">
       REQUIRE_ROW_FORMAT = 1
      </code>
      and
      <code class="literal">
       SOURCE_AUTO_POSITION = 1
      </code>
      must be set for
            the replication channel.
     </p>
     <p>
      When
      <code class="literal">
       GTID_ONLY = 1
      </code>
      is set, the replica
            uses
      <a class="link" href="replication-options-replica.html#sysvar_replica_parallel_workers">
       <code class="literal">
        replica_parallel_workers=1
       </code>
      </a>
      if that system variable is set to zero for the server, so it
            is always technically a multi-threaded applier. This is
            because a multi-threaded applier uses saved positions rather
            than the replication metadata repositories to locate the
            start of a transaction that it needs to reapply.
     </p>
     <p>
      If you disable
      <code class="literal">
       GTID_ONLY
      </code>
      after setting
            it, the existing relay logs are deleted and the existing
            known binary log file positions are persisted, even if they
            are stale. The file positions for the binary log and relay
            log in the replication metadata repositories might be
            invalid, and a warning is returned if this is the case.
            Provided that
      <code class="literal">
       SOURCE_AUTO_POSITION
      </code>
      is
            still enabled, GTID auto-positioning is used to provide the
            correct positioning.
     </p>
     <p>
      If you also disable
      <code class="literal">
       SOURCE_AUTO_POSITION
      </code>
      ,
            the file positions for the binary log and relay log in the
            replication metadata repositories are used for positioning
            if they are valid. If they are marked as invalid, you must
            provide a valid binary log file name and position
            (
      <code class="literal">
       SOURCE_LOG_FILE
      </code>
      and
      <code class="literal">
       SOURCE_LOG_POS
      </code>
      ). If you also provide a
            relay log file name and position
            (
      <code class="literal">
       RELAY_LOG_FILE
      </code>
      and
      <code class="literal">
       RELAY_LOG_POS
      </code>
      ), the relay logs are
            preserved and the applier position is set to the stated
            position. GTID auto-skip ensures that any transactions
            already applied are skipped even if the eventual applier
            position is not correct.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-ignore_server_ids">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-ignore_server_ids">
       <code class="literal">
        IGNORE_SERVER_IDS =
            (
        <em class="replaceable">
         <code>
          server_id_list
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <p>
      Makes the replica ignore events originating from the
            specified servers. The option takes a comma-separated list
            of 0 or more server IDs. Log rotation and deletion events
            from the servers are not ignored, and are recorded in the
            relay log.
     </p>
     <p>
      In circular replication, the originating server normally
            acts as the terminator of its own events, so that they are
            not applied more than once. Thus, this option is useful in
            circular replication when one of the servers in the circle
            is removed. Suppose that you have a circular replication
            setup with 4 servers, having server IDs 1, 2, 3, and 4, and
            server 3 fails. When bridging the gap by starting
            replication from server 2 to server 4, you can include
      <code class="literal">
       IGNORE_SERVER_IDS = (3)
      </code>
      in the
      <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
       <code class="literal">
        CHANGE REPLICATION SOURCE TO
       </code>
      </a>
      statement that you issue on server 4 to tell it to use
            server 2 as its source instead of server 3. Doing so causes
            it to ignore and not to propagate any statements that
            originated with the server that is no longer in use.
     </p>
     <p>
      If
      <code class="literal">
       IGNORE_SERVER_IDS
      </code>
      contains the
            server's own ID and the server was started with the
      <a class="link" href="replication-options-replica.html#option_mysqld_replicate-same-server-id">
       <code class="option">
        --replicate-same-server-id
       </code>
      </a>
      option enabled, an error results.
     </p>
     <p>
      The source metadata repository and the output of
      <a class="link" href="show-replica-status.html" title="15.7.7.35 SHOW REPLICA STATUS Statement">
       <code class="literal">
        SHOW
            REPLICA STATUS
       </code>
      </a>
      provide the list of servers that
            are currently ignored. For more information, see
      <a class="xref" href="replica-logs-status.html" title="19.2.4.2 Replication Metadata Repositories">
       Section 19.2.4.2, “Replication Metadata Repositories”
      </a>
      , and
      <a class="xref" href="show-replica-status.html" title="15.7.7.35 SHOW REPLICA STATUS Statement">
       Section 15.7.7.35, “SHOW REPLICA STATUS Statement”
      </a>
      .
     </p>
     <p>
      If a
      <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
       <code class="literal">
        CHANGE REPLICATION SOURCE
            TO
       </code>
      </a>
      statement is issued without
      <code class="literal">
       IGNORE_SERVER_IDS
      </code>
      , any existing list is
            preserved. To clear the list of ignored servers, it is
            necessary to use the option with an empty list, like this:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa21454213"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CHANGE</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span> <span class="token keyword">IGNORE_SERVER_IDS</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
     </div>
     <p>
      <a class="link" href="reset-replica.html" title="15.4.2.3 RESET REPLICA Statement">
       <code class="literal">
        RESET REPLICA
            ALL
       </code>
      </a>
      also clears
      <code class="literal">
       IGNORE_SERVER_IDS
      </code>
      .
     </p>
     <p>
      When global transaction identifiers (GTIDs) are used for
            replication, transactions that have already been applied are
            automatically ignored. Because of this,
      <code class="literal">
       IGNORE_SERVER_IDS
      </code>
      is not compatible with
      <a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
       <code class="literal">
        gtid_mode=ON
       </code>
      </a>
      . If
      <code class="literal">
       gtid_mode
      </code>
      is
      <code class="literal">
       ON
      </code>
      ,
      <code class="literal">
       CHANGE REPLICATION SOURCE TO
      </code>
      with a
            non-empty
      <code class="literal">
       IGNORE_SERVER_IDS
      </code>
      list is
            rejected with an error. Likewise, if any existing
            replication channel was created with a list of server IDs to
            be ignored,
      <code class="literal">
       SET gtid_mode=ON
      </code>
      is also
            rejected. Before starting GTID-based replication, check for
            and clear any ignored server ID lists on the servers
            involved; you can do this by checking the output from
      <a class="link" href="show-replica-status.html" title="15.7.7.35 SHOW REPLICA STATUS Statement">
       <code class="literal">
        SHOW REPLICA STATUS
       </code>
      </a>
      . In such
            cases, you can clear the list by issuing
      <code class="literal">
       CHANGE
            REPLICATION SOURCE TO
      </code>
      with an empty list of server
            IDs as shown previously.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-network_namespace">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-network_namespace">
       <code class="literal">
        NETWORK_NAMESPACE =
            '
        <em class="replaceable">
         <code>
          namespace
         </code>
        </em>
        '
       </code>
      </a>
     </p>
     <p>
      The network namespace to use for TCP/IP connections to the
            replication source server or, if the MySQL communication
            stack is in use, for Group Replication’s group
            communication connections. The maximum length of the string
            value is 64 characters. If this option is omitted,
            connections from the replica use the default (global)
            namespace. On platforms that do not implement network
            namespace support, failure occurs when the replica attempts
            to connect to the source. For information about network
            namespaces, see
      <a class="xref" href="network-namespace-support.html" title="7.1.14 Network Namespace Support">
       Section 7.1.14, “Network Namespace Support”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-privilege_checks_user">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-privilege_checks_user">
       <code class="literal">
        PRIVILEGE_CHECKS_USER = {NULL |
            '
        <em class="replaceable">
         <code>
          account
         </code>
        </em>
        '}
       </code>
      </a>
     </p>
     <p>
      Names a user account that supplies a security context for
            the specified channel.
      <code class="literal">
       NULL
      </code>
      , which is the
            default, means no security context is used.
     </p>
     <p>
      The user name and host name for the user account must follow
            the syntax described in
      <a class="xref" href="account-names.html" title="8.2.4 Specifying Account Names">
       Section 8.2.4, “Specifying Account Names”
      </a>
      , and
            the user must not be an anonymous user (with a blank user
            name) or the
      <code class="literal">
       CURRENT_USER
      </code>
      . The account
            must have the
      <a class="link" href="privileges-provided.html#priv_replication-applier">
       <code class="literal">
        REPLICATION_APPLIER
       </code>
      </a>
      privilege, plus the required privileges to execute the
            transactions replicated on the channel. For details of the
            privileges required by the account, see
      <a class="xref" href="replication-privilege-checks.html" title="19.3.3 Replication Privilege Checks">
       Section 19.3.3, “Replication Privilege Checks”
      </a>
      . When you
            restart the replication channel, the privilege checks are
            applied from that point on. If you do not specify a channel
            and no other channels exist, the statement is applied to the
            default channel.
     </p>
     <p>
      The use of row-based binary logging is strongly recommended
            when
      <code class="literal">
       PRIVILEGE_CHECKS_USER
      </code>
      is set, and
            you can set
      <code class="literal">
       REQUIRE_ROW_FORMAT
      </code>
      to enforce
            this. For example, to start privilege checks on the channel
      <code class="literal">
       channel_1
      </code>
      on a running replica, issue the
            following statements:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa64254625"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">STOP</span> <span class="token keyword">REPLICA</span> <span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">'channel_1'</span><span class="token punctuation">;</span>

<span class="token keyword">CHANGE</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span>
    <span class="token keyword">PRIVILEGE_CHECKS_USER</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">user</em>'</span>@<span class="token string">'<em class="replaceable">host</em>'</span><span class="token punctuation">,</span>
    <span class="token keyword">REQUIRE_ROW_FORMAT</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span>
    <span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">'channel_1'</span><span class="token punctuation">;</span>

<span class="token keyword">START</span> <span class="token keyword">REPLICA</span> <span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">'channel_1'</span><span class="token punctuation">;</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-relay_log_file">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-relay_log_file">
       <code class="literal">
        RELAY_LOG_FILE =
            '
        <em class="replaceable">
         <code>
          relay_log_file
         </code>
        </em>
        '
       </code>
      </a>
      ,
      <a class="link" href="change-replication-source-to.html#crs-opt-relay_log_file">
       <code class="literal">
        RELAY_LOG_POS =
            '
        <em class="replaceable">
         <code>
          relay_log_pos
         </code>
        </em>
        '
       </code>
      </a>
     </p>
     <p>
      The relay log file name, and the location in that file, at
            which the replication SQL thread begins reading from the
            replica's relay log the next time the thread starts.
      <code class="literal">
       RELAY_LOG_FILE
      </code>
      can use either an absolute
            or relative path, and uses the same base name as
      <code class="literal">
       SOURCE_LOG_FILE
      </code>
      . The maximum length of
            the string value is 511 characters.
     </p>
     <p>
      A
      <code class="literal">
       CHANGE REPLICATION SOURCE TO
      </code>
      statement
            using
      <code class="literal">
       RELAY_LOG_FILE
      </code>
      ,
      <code class="literal">
       RELAY_LOG_POS
      </code>
      , or both options can be
            executed on a running replica when the replication SQL
            (applier) thread is stopped. Relay logs are preserved if at
            least one of the replication applier thread and the
            replication I/O (receiver) thread is running. If both
            threads are stopped, all relay log files are deleted unless
            at least one of
      <code class="literal">
       RELAY_LOG_FILE
      </code>
      or
      <code class="literal">
       RELAY_LOG_POS
      </code>
      is specified. For the Group
            Replication applier channel
            (
      <code class="literal">
       group_replication_applier
      </code>
      ), which only
            has an applier thread and no receiver thread, this is the
            case if the applier thread is stopped, but with that channel
            you cannot use the
      <code class="literal">
       RELAY_LOG_FILE
      </code>
      and
      <code class="literal">
       RELAY_LOG_POS
      </code>
      options.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-require_row_format">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-require_row_format">
       <code class="literal">
        REQUIRE_ROW_FORMAT = {0|1}
       </code>
      </a>
     </p>
     <p>
      Permits only row-based replication events to be processed by
            the replication channel. This option prevents the
            replication applier from taking actions such as creating
            temporary tables and executing
      <code class="literal">
       LOAD DATA
            INFILE
      </code>
      requests, which increases the security of
            the channel. The
      <code class="literal">
       REQUIRE_ROW_FORMAT
      </code>
      option is disabled by default for asynchronous replication
            channels, but it is enabled by default for Group Replication
            channels, and it cannot be disabled for them. For more
            information, see
      <a class="xref" href="replication-privilege-checks.html" title="19.3.3 Replication Privilege Checks">
       Section 19.3.3, “Replication Privilege Checks”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-require_table_primary_key_check">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-require_table_primary_key_check">
       <code class="literal">
        REQUIRE_TABLE_PRIMARY_KEY_CHECK =
            {STREAM | ON | OFF | GENERATE}
       </code>
      </a>
     </p>
     <p>
      This option lets a replica set its own policy for primary
            key checks, as follows:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         <code class="literal">
          ON
         </code>
         : The replica sets
         <a class="link" href="server-system-variables.html#sysvar_sql_require_primary_key">
          <code class="literal">
           sql_require_primary_key =
                ON
          </code>
         </a>
         ; any replicated
         <a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
          <code class="literal">
           CREATE
                TABLE
          </code>
         </a>
         or
         <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
          <code class="literal">
           ALTER
                TABLE
          </code>
         </a>
         statement must result in a table that
                contains a primary key.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          OFF
         </code>
         : The replica sets
         <code class="literal">
          sql_require_primary_key = OFF
         </code>
         ; no
                replicated
         <code class="literal">
          CREATE TABLE
         </code>
         or
         <code class="literal">
          ALTER TABLE
         </code>
         statement is checked for
                the presence of a primary key.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          STREAM
         </code>
         : The replica uses whatever
                value of
         <code class="literal">
          sql_require_primary_key
         </code>
         is
                replicated from the source for each transaction. This is
                the default value, and the default behavior.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          GENERATE
         </code>
         : Causes the replica to
                generate an invisible primary key for any
         <a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
          <code class="literal">
           InnoDB
          </code>
         </a>
         table that, as
                replicated, lacks a primary key. See
         <a class="xref" href="create-table-gipks.html" title="15.1.20.11 Generated Invisible Primary Keys">
          Section 15.1.20.11, “Generated Invisible Primary Keys”
         </a>
         , for more
                information.
        </p>
        <p>
         <code class="literal">
          GENERATE
         </code>
         is not compatible with Group
                Replication; you can use
         <code class="literal">
          ON
         </code>
         ,
         <code class="literal">
          OFF
         </code>
         , or
         <code class="literal">
          STREAM
         </code>
         .
        </p>
       </li>
      </ul>
     </div>
     <p>
      A divergence based on the presence of a generated invisible
            primary key solely on a source or replica table is supported
            by MySQL Replication as long as the source supports GIPKs
            and the replica uses MySQL version 8.0.32 or later. If you
            use GIPKs on a replica with the source using an earlier
            version of MySQL, such divergences in schema, other than the
            extra GIPK on the replica, are not supported and may result
            in replication errors.
     </p>
     <p>
      For multisource replication, setting
      <code class="literal">
       REQUIRE_TABLE_PRIMARY_KEY_CHECK
      </code>
      to
      <code class="literal">
       ON
      </code>
      or
      <code class="literal">
       OFF
      </code>
      lets the
            replica normalize behavior across replication channels for
            different sources, and to keep a consistent setting for
      <a class="link" href="server-system-variables.html#sysvar_sql_require_primary_key">
       <code class="literal">
        sql_require_primary_key
       </code>
      </a>
      .
            Using
      <code class="literal">
       ON
      </code>
      safeguards against the
            accidental loss of primary keys when multiple sources update
            the same set of tables. Using
      <code class="literal">
       OFF
      </code>
      lets
            sources that can manipulate primary keys to work alongside
            sources that cannot.
     </p>
     <p>
      In the case of multiple replicas, when
      <code class="literal">
       REQUIRE_TABLE_PRIMARY_KEY_CHECK
      </code>
      is set to
      <code class="literal">
       GENERATE
      </code>
      , the generated invisible primary
            key added by a given replica is independent of any such key
            added on any other replica. This means that, if generated
            invisible primary keys are in use, the values in the
            generated primary key columns on different replicas are not
            guaranteed to be the same. This may be an issue when failing
            over to such a replica.
     </p>
     <p>
      When
      <code class="literal">
       PRIVILEGE_CHECKS_USER
      </code>
      is
      <code class="literal">
       NULL
      </code>
      (the default), the user account does
            not need administration level privileges to set restricted
            session variables. Setting this option to a value other than
      <code class="literal">
       NULL
      </code>
      means that, when
      <code class="literal">
       REQUIRE_TABLE_PRIMARY_KEY_CHECK
      </code>
      is
      <code class="literal">
       ON
      </code>
      ,
      <code class="literal">
       OFF
      </code>
      , or
      <code class="literal">
       GENERATE
      </code>
      , the user account does not
            require session administration level privileges to set
            restricted session variables such as
      <a class="link" href="server-system-variables.html#sysvar_sql_require_primary_key">
       <code class="literal">
        sql_require_primary_key
       </code>
      </a>
      ,
            avoiding the need to grant the account such privileges. For
            more information, see
      <a class="xref" href="replication-privilege-checks.html" title="19.3.3 Replication Privilege Checks">
       Section 19.3.3, “Replication Privilege Checks”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_auto_position">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_auto_position">
       <code class="literal">
        SOURCE_AUTO_POSITION =
            {0|1}
       </code>
      </a>
     </p>
     <p>
      Makes the replica attempt to connect to the source using the
            auto-positioning feature of GTID-based replication, rather
            than a binary log file based position. This option is used
            to start a replica using GTID-based replication. The default
            is 0, meaning that GTID auto-positioning and GTID-based
            replication are not used. This option can be used with
      <code class="literal">
       CHANGE REPLICATION SOURCE TO
      </code>
      only if both
            the replication SQL (applier) thread and replication I/O
            (receiver) thread are stopped.
     </p>
     <p>
      Both the replica and the source must have GTIDs enabled
            (
      <a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
       <code class="literal">
        GTID_MODE=ON
       </code>
      </a>
      ,
      <code class="literal">
       ON_PERMISSIVE,
      </code>
      or
      <code class="literal">
       OFF_PERMISSIVE
      </code>
      on the replica, and
      <a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
       <code class="literal">
        GTID_MODE=ON
       </code>
      </a>
      on the
            source).
      <code class="literal">
       SOURCE_LOG_FILE
      </code>
      ,
      <code class="literal">
       SOURCE_LOG_POS
      </code>
      ,
      <code class="literal">
       RELAY_LOG_FILE
      </code>
      , and
      <code class="literal">
       RELAY_LOG_POS
      </code>
      cannot be specified
            together with
      <code class="literal">
       SOURCE_AUTO_POSITION = 1
      </code>
      .
            If multi-source replication is enabled on the replica, you
            need to set the
      <code class="literal">
       SOURCE_AUTO_POSITION = 1
      </code>
      option for each applicable replication channel.
     </p>
     <p>
      With
      <code class="literal">
       SOURCE_AUTO_POSITION = 1
      </code>
      set, in the
            initial connection handshake, the replica sends a GTID set
            containing the transactions that it has already received,
            committed, or both. The source responds by sending all
            transactions recorded in its binary log whose GTID is not
            included in the GTID set sent by the replica. This exchange
            ensures that the source only sends the transactions with a
            GTID that the replica has not already recorded or committed.
            If the replica receives transactions from more than one
            source, as in the case of a diamond topology, the auto-skip
            function ensures that the transactions are not applied
            twice. For details of how the GTID set sent by the replica
            is computed, see
      <a class="xref" href="replication-gtids-auto-positioning.html" title="19.1.3.3 GTID Auto-Positioning">
       Section 19.1.3.3, “GTID Auto-Positioning”
      </a>
      .
     </p>
     <p>
      If any of the transactions that should be sent by the source
            have been purged from the source's binary log, or added to
            the set of GTIDs in the
      <a class="link" href="replication-options-gtids.html#sysvar_gtid_purged">
       <code class="literal">
        gtid_purged
       </code>
      </a>
      system variable
            by another method, the source sends the error
      <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_source_has_purged_required_gtids" target="_top">
       <code class="literal">
        ER_SOURCE_HAS_PURGED_REQUIRED_GTIDS
       </code>
      </a>
      to the replica, and replication does not start. The GTIDs of
            the missing purged transactions are identified and listed in
            the source's error log in the warning message
      <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_found_missing_gtids" target="_top">
       <code class="literal">
        ER_FOUND_MISSING_GTIDS
       </code>
      </a>
      .
            Also, if during the exchange of transactions it is found
            that the replica has recorded or committed transactions with
            the source's UUID in the GTID, but the source itself has not
            committed them, the source sends the error
      <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_replica_has_more_gtids_than_source" target="_top">
       <code class="literal">
        ER_REPLICA_HAS_MORE_GTIDS_THAN_SOURCE
       </code>
      </a>
      to the replica and replication does not start. For
            information on how to handle these situations, see
      <a class="xref" href="replication-gtids-auto-positioning.html" title="19.1.3.3 GTID Auto-Positioning">
       Section 19.1.3.3, “GTID Auto-Positioning”
      </a>
      .
     </p>
     <p>
      You can see whether replication is running with GTID
            auto-positioning enabled by checking the Performance Schema
      <a class="link" href="performance-schema-replication-connection-status-table.html" title="29.12.11.13 The replication_connection_status Table">
       <code class="literal">
        replication_connection_status
       </code>
      </a>
      table or the output of
      <a class="link" href="show-replica-status.html" title="15.7.7.35 SHOW REPLICA STATUS Statement">
       <code class="literal">
        SHOW
            REPLICA STATUS
       </code>
      </a>
      . Disabling the
      <code class="literal">
       SOURCE_AUTO_POSITION
      </code>
      option again makes
            the replica revert to file-based replication.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_bind">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_bind">
       <code class="literal">
        SOURCE_BIND =
            '
        <em class="replaceable">
         <code>
          interface_name
         </code>
        </em>
        '
       </code>
      </a>
     </p>
     <p>
      Determines which of the replica's network interfaces is
            chosen for connecting to the source, for use on replicas
            that have multiple network interfaces. Specify the IP
            address of the network interface. The maximum length of the
            string value is 255 characters.
     </p>
     <p>
      The IP address configured with this option, if any, can be
            seen in the
      <code class="literal">
       Source_Bind
      </code>
      column of the
            output from
      <a class="link" href="show-replica-status.html" title="15.7.7.35 SHOW REPLICA STATUS Statement">
       <code class="literal">
        SHOW
            REPLICA STATUS
       </code>
      </a>
      . In the source metadata repository
            table
      <code class="literal">
       mysql.slave_master_info
      </code>
      , the value
            can be seen as the
      <code class="literal">
       Source_bind
      </code>
      column.
            The ability to bind a replica to a specific network
            interface is also supported by NDB Cluster.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_compression_algorithms">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_compression_algorithms">
       <code class="literal">
        SOURCE_COMPRESSION_ALGORITHMS =
            '
        <em class="replaceable">
         <code>
          algorithm
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          algorithm
         </code>
        </em>
        ][,
        <em class="replaceable">
         <code>
          algorithm
         </code>
        </em>
        ]'
       </code>
      </a>
     </p>
     <p>
      Specifies one, two, or three of the permitted compression
            algorithms for connections to the replication source server,
            separated by commas. The maximum length of the string value
            is 99 characters. The default value is
      <code class="literal">
       uncompressed
      </code>
      .
     </p>
     <p>
      The available algorithms are
      <code class="literal">
       zlib
      </code>
      ,
      <code class="literal">
       zstd
      </code>
      , and
      <code class="literal">
       uncompressed
      </code>
      , the same as for the
      <a class="link" href="server-system-variables.html#sysvar_protocol_compression_algorithms">
       <code class="literal">
        protocol_compression_algorithms
       </code>
      </a>
      system variable. The algorithms can be specified in any
            order, but it is not an order of preference - the algorithm
            negotiation process attempts to use
      <code class="literal">
       zlib
      </code>
      ,
            then
      <code class="literal">
       zstd
      </code>
      , then
      <code class="literal">
       uncompressed
      </code>
      , if they are specified.
     </p>
     <p>
      The value of
      <code class="literal">
       SOURCE_COMPRESSION_ALGORITHMS
      </code>
      applies
            only if the
      <a class="link" href="replication-options-replica.html#sysvar_replica_compressed_protocol">
       <code class="literal">
        replica_compressed_protocol
       </code>
      </a>
      system variable is disabled. If
      <code class="literal">
       replica_compressed_protocol
      </code>
      is enabled,
            it takes precedence over
      <code class="literal">
       SOURCE_COMPRESSION_ALGORITHMS
      </code>
      and
            connections to the source use
      <code class="literal">
       zlib
      </code>
      compression if both source and replica support that
            algorithm. For more information, see
      <a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
       Section 6.2.8, “Connection Compression Control”
      </a>
      .
     </p>
     <p>
      Binary log transaction compression is activated by the
      <a class="link" href="replication-options-binary-log.html#sysvar_binlog_transaction_compression">
       <code class="literal">
        binlog_transaction_compression
       </code>
      </a>
      system variable, and can also be used to save bandwidth. If
            you do this in combination with connection compression,
            connection compression has less opportunity to act on the
            data, but can still compress headers and those events and
            transaction payloads that are uncompressed. For more
            information on binary log transaction compression, see
      <a class="xref" href="binary-log-transaction-compression.html" title="7.4.4.5 Binary Log Transaction Compression">
       Section 7.4.4.5, “Binary Log Transaction Compression”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_connect_retry">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_connect_retry">
       <code class="literal">
        SOURCE_CONNECT_RETRY =
        <em class="replaceable">
         <code>
          interval
         </code>
        </em>
       </code>
      </a>
     </p>
     <p>
      Specifies the interval in seconds between the reconnection
            attempts that the replica makes after the connection to the
            source times out. The default interval is 60.
     </p>
     <p>
      The number of attempts is limited by the
      <code class="literal">
       SOURCE_RETRY_COUNT
      </code>
      option. If both the
            default settings are used, the replica waits 60 seconds
            between reconnection attempts
            (
      <code class="literal">
       SOURCE_CONNECT_RETRY=60
      </code>
      ), and keeps
            attempting to reconnect at this rate for 10 minutes
            (
      <code class="literal">
       SOURCE_RETRY_COUNT=10
      </code>
      ). These values are
            recorded in the source metadata repository and shown in the
      <a class="link" href="performance-schema-replication-connection-configuration-table.html" title="29.12.11.11 The replication_connection_configuration Table">
       <code class="literal">
        replication_connection_configuration
       </code>
      </a>
      Performance Schema table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_connection_auto_failover">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_connection_auto_failover">
       <code class="literal">
        SOURCE_CONNECTION_AUTO_FAILOVER =
            {0|1}
       </code>
      </a>
     </p>
     <p>
      Activates the asynchronous connection failover mechanism for
            a replication channel if one or more alternative replication
            source servers are available (so when there are multiple
            MySQL servers or groups of servers that share the replicated
            data). The default is 0, meaning that the mechanism is not
            activated. For full information and instructions to set up
            this feature, see
      <a class="xref" href="replication-asynchronous-connection-failover-replica.html" title="19.4.9.2 Asynchronous Connection Failover for Replicas">
       Section 19.4.9.2, “Asynchronous Connection Failover for Replicas”
      </a>
      .
     </p>
     <p>
      The asynchronous connection failover mechanism takes over
            after the reconnection attempts controlled by
      <code class="literal">
       SOURCE_CONNECT_RETRY
      </code>
      and
      <code class="literal">
       SOURCE_RETRY_COUNT
      </code>
      are exhausted. It
            reconnects the replica to an alternative source chosen from
            a specified source list, which you can manage using the
            functions
      <a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-add-source">
       <code class="literal">
        asynchronous_connection_failover_add_source()
       </code>
      </a>
      and
      <a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-delete-source">
       <code class="literal">
        asynchronous_connection_failover_delete_source()
       </code>
      </a>
      .
            To add and remove managed groups of servers, use
      <a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-add-managed">
       <code class="literal">
        asynchronous_connection_failover_add_managed()
       </code>
      </a>
      and
      <a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-delete-managed">
       <code class="literal">
        asynchronous_connection_failover_delete_managed()
       </code>
      </a>
      instead. For more information, see
      <a class="xref" href="replication-asynchronous-connection-failover.html" title="19.4.9 Switching Sources and Replicas with Asynchronous Connection Failover">
       Section 19.4.9, “Switching Sources and Replicas with Asynchronous Connection Failover”
      </a>
      .
     </p>
     <div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Important
      </div>
      <div class="orderedlist">
       <ol class="orderedlist" type="1">
        <li class="listitem">
         <p>
          You can only set
          <code class="literal">
           SOURCE_CONNECTION_AUTO_FAILOVER = 1
          </code>
          when GTID auto-positioning is in use
                  (
          <code class="literal">
           SOURCE_AUTO_POSITION = 1
          </code>
          ).
         </p>
        </li>
        <li class="listitem">
         <p>
          When you set
          <code class="literal">
           SOURCE_CONNECTION_AUTO_FAILOVER
                  = 1
          </code>
          , set
          <code class="literal">
           SOURCE_RETRY_COUNT
          </code>
          and
          <code class="literal">
           SOURCE_CONNECT_RETRY
          </code>
          to minimal
                  numbers that just allow a few retry attempts with the
                  same source, in case the connection failure is caused
                  by a transient network outage. Otherwise the
                  asynchronous connection failover mechanism cannot be
                  activated promptly. Suitable values are
          <code class="literal">
           SOURCE_RETRY_COUNT=3
          </code>
          and
          <code class="literal">
           SOURCE_CONNECT_RETRY=10
          </code>
          , which make
                  the replica retry the connection 3 times with
                  10-second intervals between.
         </p>
        </li>
        <li class="listitem">
         <p>
          When you set
          <code class="literal">
           SOURCE_CONNECTION_AUTO_FAILOVER
                  = 1
          </code>
          , the replication metadata repositories
                  must contain the credentials for a replication user
                  account that can be used to connect to all the servers
                  on the source list for the replication channel. The
                  account must also have
          <code class="literal">
           SELECT
          </code>
          permissions on the Performance Schema tables. These
                  credentials can be set using the
          <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
           <code class="literal">
            CHANGE REPLICATION SOURCE
                  TO
           </code>
          </a>
          statement with the
          <code class="literal">
           SOURCE_USER
          </code>
          and
          <code class="literal">
           SOURCE_PASSWORD
          </code>
          options. For more
                  information, see
          <a class="xref" href="replication-asynchronous-connection-failover.html" title="19.4.9 Switching Sources and Replicas with Asynchronous Connection Failover">
           Section 19.4.9, “Switching Sources and Replicas with Asynchronous Connection Failover”
          </a>
          .
         </p>
        </li>
        <li class="listitem">
         <p>
          When you set
          <code class="literal">
           SOURCE_CONNECTION_AUTO_FAILOVER
                  = 1
          </code>
          , asynchronous connection failover for
                  replicas is automatically activated if this
                  replication channel is on a Group Replication primary
                  in a group in single-primary mode. With this function
                  active, if the primary that is replicating goes
                  offline or into an error state, the new primary starts
                  replication on the same channel when it is elected. If
                  you want to use the function, this replication channel
                  must also be set up on all the secondary servers in
                  the replication group, and on any new joining members.
                  (If the servers are provisioned using MySQL’s clone
                  functionality, this all happens automatically.) If you
                  do not want to use the function, disable it by using
                  the
          <a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-disable-member-action">
           <code class="literal">
            group_replication_disable_member_action()
           </code>
          </a>
          function to disable the Group Replication member
                  action
          <code class="literal">
           mysql_start_failover_channels_if_primary
          </code>
          ,
                  which is enabled by default. For more information, see
          <a class="xref" href="replication-asynchronous-connection-failover-replica.html" title="19.4.9.2 Asynchronous Connection Failover for Replicas">
           Section 19.4.9.2, “Asynchronous Connection Failover for Replicas”
          </a>
          .
         </p>
        </li>
       </ol>
      </div>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_delay">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_delay">
       <code class="literal">
        SOURCE_DELAY =
        <em class="replaceable">
         <code>
          interval
         </code>
        </em>
       </code>
      </a>
     </p>
     <p>
      Specifies how many seconds behind the source the replica
            must lag. An event received from the source is not executed
            until at least
      <em class="replaceable">
       <code>
        interval
       </code>
      </em>
      seconds
            later than its execution on the source.
      <em class="replaceable">
       <code>
        interval
       </code>
      </em>
      must be a nonnegative
            integer in the range from 0 to
            2
      <sup>
       31
      </sup>
      −1. The default is 0.
            For more information, see
      <a class="xref" href="replication-delayed.html" title="19.4.11 Delayed Replication">
       Section 19.4.11, “Delayed Replication”
      </a>
      .
     </p>
     <p>
      A
      <code class="literal">
       CHANGE REPLICATION SOURCE TO
      </code>
      statement
            using the
      <code class="literal">
       SOURCE_DELAY
      </code>
      option can be
            executed on a running replica when the replication SQL
            thread is stopped.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_heartbeat_period">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_heartbeat_period">
       <code class="literal">
        SOURCE_HEARTBEAT_PERIOD =
        <em class="replaceable">
         <code>
          interval
         </code>
        </em>
       </code>
      </a>
     </p>
     <p>
      Controls the heartbeat interval, which stops the connection
            timeout occurring in the absence of data if the connection
            is still good. A heartbeat signal is sent to the replica
            after that number of seconds, and the waiting period is
            reset whenever the source's binary log is updated with an
            event. Heartbeats are therefore sent by the source only if
            there are no unsent events in the binary log file for a
            period longer than this.
     </p>
     <p>
      The heartbeat interval
      <em class="replaceable">
       <code>
        interval
       </code>
      </em>
      is a decimal value having the range 0 to 4294967 seconds and
            a resolution in milliseconds; the smallest nonzero value is
            0.001. Setting
      <em class="replaceable">
       <code>
        interval
       </code>
      </em>
      to 0
            disables heartbeats altogether. The heartbeat interval
            defaults to half the value of the
      <a class="link" href="replication-options-replica.html#sysvar_replica_net_timeout">
       <code class="literal">
        replica_net_timeout
       </code>
      </a>
      system
            variable. It is recorded in the source metadata repository
            and shown in the
      <a class="link" href="performance-schema-replication-connection-configuration-table.html" title="29.12.11.11 The replication_connection_configuration Table">
       <code class="literal">
        replication_connection_configuration
       </code>
      </a>
      Performance Schema table.
     </p>
     <p>
      The
      <a class="link" href="replication-options-replica.html#sysvar_replica_net_timeout">
       <code class="literal">
        replica_net_timeout
       </code>
      </a>
      system variable specifies the number of seconds that the
            replica waits for either more data or a heartbeat signal
            from the source, before the replica considers the connection
            broken, aborts the read, and tries to reconnect. The default
            value is 60 seconds (one minute). Note that a change to the
            value or default setting of
      <a class="link" href="replication-options-replica.html#sysvar_replica_net_timeout">
       <code class="literal">
        replica_net_timeout
       </code>
      </a>
      does
            not automatically change the heartbeat interval, whether
            that has been set explicitly or is using a previously
            calculated default. A warning is issued if you set the
            global value of
      <code class="literal">
       replica_net_timeout
      </code>
      to a
            value less than that of the current heartbeat interval. If
      <code class="literal">
       replica_net_timeout
      </code>
      is changed, you must
            also issue
      <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
       <code class="literal">
        CHANGE REPLICATION SOURCE
            TO
       </code>
      </a>
      to adjust the heartbeat interval to an
            appropriate value so that the heartbeat signal occurs before
            the connection timeout. If you do not do this, the heartbeat
            signal has no effect, and if no data is received from the
            source, the replica can make repeated reconnection attempts,
            creating zombie dump threads.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_host">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_host">
       <code class="literal">
        SOURCE_HOST =
            '
        <em class="replaceable">
         <code>
          host_name
         </code>
        </em>
        '
       </code>
      </a>
     </p>
     <p>
      The host name or IP address of the replication source
            server. The replica uses this to connect to the source. The
            maximum length of the string value is 255 characters.
     </p>
     <p>
      If you specify
      <code class="literal">
       SOURCE_HOST
      </code>
      or
      <code class="literal">
       SOURCE_PORT
      </code>
      , the replica assumes that the
            source server is different from before (even if the option
            value is the same as its current value.) In this case, the
            old values for the source's binary log file name and
            position are considered no longer applicable, so if you do
            not specify
      <code class="literal">
       SOURCE_LOG_FILE
      </code>
      and
      <code class="literal">
       SOURCE_LOG_POS
      </code>
      in the statement,
      <code class="literal">
       SOURCE_LOG_FILE=''
      </code>
      and
      <code class="literal">
       SOURCE_LOG_POS=4
      </code>
      are silently appended to
            it.
     </p>
     <p>
      Setting
      <code class="literal">
       SOURCE_HOST=''
      </code>
      (that is, setting
            its value explicitly to an empty string) is
      <span class="emphasis">
       <em>
        not
       </em>
      </span>
      the same as not setting
      <code class="literal">
       SOURCE_HOST
      </code>
      at all. Trying to set
      <code class="literal">
       SOURCE_HOST
      </code>
      to an empty string fails with
            an error.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_log_file">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_log_file">
       <code class="literal">
        SOURCE_LOG_FILE =
            '
        <em class="replaceable">
         <code>
          source_log_name
         </code>
        </em>
        '
       </code>
      </a>
      ,
      <a class="link" href="change-replication-source-to.html#crs-opt-source_log_file">
       <code class="literal">
        SOURCE_LOG_POS =
        <em class="replaceable">
         <code>
          source_log_pos
         </code>
        </em>
       </code>
      </a>
     </p>
     <p>
      The binary log file name, and the location in that file, at
            which the replication I/O (receiver) thread begins reading
            from the source's binary log the next time the thread
            starts. Specify these options if you are using binary log
            file position based replication.
     </p>
     <p>
      <code class="literal">
       SOURCE_LOG_FILE
      </code>
      must include the numeric
            suffix of a specific binary log file that is available on
            the source server, for example,
      <code class="literal">
       SOURCE_LOG_FILE='binlog.000145'
      </code>
      . The
            maximum length of the string value is 511 characters.
     </p>
     <p>
      <code class="literal">
       SOURCE_LOG_POS
      </code>
      is the numeric position
            for the replica to start reading in that file.
      <code class="literal">
       SOURCE_LOG_POS=4
      </code>
      represents the start of
            the events in a binary log file.
     </p>
     <p>
      If you specify either of
      <code class="literal">
       SOURCE_LOG_FILE
      </code>
      or
      <code class="literal">
       SOURCE_LOG_POS
      </code>
      , you cannot specify
      <code class="literal">
       SOURCE_AUTO_POSITION = 1
      </code>
      , which is for
            GTID-based replication.
     </p>
     <p>
      If neither of
      <code class="literal">
       SOURCE_LOG_FILE
      </code>
      or
      <code class="literal">
       SOURCE_LOG_POS
      </code>
      is specified, the replica
            uses the last coordinates of the
      <span class="emphasis">
       <em>
        replication SQL
            thread
       </em>
      </span>
      before
      <code class="literal">
       CHANGE REPLICATION SOURCE
            TO
      </code>
      was issued. This ensures that there is no
            discontinuity in replication, even if the replication SQL
            (applier) thread was late compared to the replication I/O
            (receiver) thread.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_password">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_password">
       <code class="literal">
        SOURCE_PASSWORD =
            '
        <em class="replaceable">
         <code>
          password
         </code>
        </em>
        '
       </code>
      </a>
     </p>
     <p>
      The password for the replication user account to use for
            connecting to the replication source server. The maximum
            length of the string value is 32 characters. If you specify
      <code class="literal">
       SOURCE_PASSWORD
      </code>
      ,
      <code class="literal">
       SOURCE_USER
      </code>
      is also required.
     </p>
     <p>
      The password used for a replication user account in a
      <code class="literal">
       CHANGE REPLICATION SOURCE TO
      </code>
      statement is
            limited to 32 characters in length. Trying to use a password
            of more than 32 characters causes
      <code class="literal">
       CHANGE
            REPLICATION SOURCE TO
      </code>
      to fail.
     </p>
     <p>
      The password is masked in MySQL Server’s logs, Performance
            Schema tables, and
      <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
       <code class="literal">
        SHOW
            PROCESSLIST
       </code>
      </a>
      statements.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_port">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_port">
       <code class="literal">
        SOURCE_PORT =
        <em class="replaceable">
         <code>
          port_num
         </code>
        </em>
       </code>
      </a>
     </p>
     <p>
      The TCP/IP port number that the replica uses to connect to
            the replication source server.
     </p>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       Replication cannot use Unix socket files. You must be able
              to connect to the replication source server using TCP/IP.
      </p>
     </div>
     <p>
      If you specify
      <code class="literal">
       SOURCE_HOST
      </code>
      or
      <code class="literal">
       SOURCE_PORT
      </code>
      , the replica assumes that the
            source server is different from before (even if the option
            value is the same as its current value.) In this case, the
            old values for the source's binary log file name and
            position are considered no longer applicable, so if you do
            not specify
      <code class="literal">
       SOURCE_LOG_FILE
      </code>
      and
      <code class="literal">
       SOURCE_LOG_POS
      </code>
      in the statement,
      <code class="literal">
       SOURCE_LOG_FILE=''
      </code>
      and
      <code class="literal">
       SOURCE_LOG_POS=4
      </code>
      are silently appended to
            it.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_public_key_path">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_public_key_path">
       <code class="literal">
        SOURCE_PUBLIC_KEY_PATH =
            '
        <em class="replaceable">
         <code>
          key_file_name
         </code>
        </em>
        '
       </code>
      </a>
     </p>
     <p>
      Enables RSA key pair-based password exchange by providing
            the path name to a file containing a replica-side copy of
            the public key required by the source. The file must be in
            PEM format. The maximum length of the string value is 511
            characters.
     </p>
     <p>
      This option applies to replicas that authenticate with the
      <code class="literal">
       sha256_password
      </code>
      (deprecated) or
      <code class="literal">
       caching_sha2_password
      </code>
      authentication
            plugin. (For
      <code class="literal">
       sha256_password
      </code>
      ,
      <code class="literal">
       SOURCE_PUBLIC_KEY_PATH
      </code>
      can be used only
            if MySQL was built using OpenSSL.) If you are using a
            replication user account that authenticates with the
      <code class="literal">
       caching_sha2_password
      </code>
      plugin (the
            default), and you are not using a secure connection, you
            must specify either this option or the
      <code class="literal">
       GET_SOURCE_PUBLIC_KEY=1
      </code>
      option to provide
            the RSA public key to the replica.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_retry_count">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_retry_count">
       <code class="literal">
        SOURCE_RETRY_COUNT =
        <em class="replaceable">
         <code>
          count
         </code>
        </em>
       </code>
      </a>
     </p>
     <p>
      Sets the maximum number of reconnection attempts that the
            replica makes after the connection to the source times out,
            as determined by the
      <a class="link" href="replication-options-replica.html#sysvar_replica_net_timeout">
       <code class="literal">
        replica_net_timeout
       </code>
      </a>
      system
            variable. If the replica does need to reconnect, the first
            retry occurs immediately after the timeout. The default is
            10 attempts.
     </p>
     <p>
      The interval between the attempts is specified by the
      <code class="literal">
       SOURCE_CONNECT_RETRY
      </code>
      option. If both the
            default settings are used, the replica waits 60 seconds
            between reconnection attempts
            (
      <code class="literal">
       SOURCE_CONNECT_RETRY=60
      </code>
      ), and keeps
            attempting to reconnect at this rate for 10 minutes
            (
      <code class="literal">
       SOURCE_RETRY_COUNT=10
      </code>
      ). A setting of 0
            for
      <code class="literal">
       SOURCE_RETRY_COUNT
      </code>
      means that there
            is no limit on the number of reconnection attempts, so the
            replica keeps trying to reconnect indefinitely.
     </p>
     <p>
      The values for
      <code class="literal">
       SOURCE_CONNECT_RETRY
      </code>
      and
      <code class="literal">
       SOURCE_RETRY_COUNT
      </code>
      are recorded in the
            source metadata repository and shown in the
      <a class="link" href="performance-schema-replication-connection-configuration-table.html" title="29.12.11.11 The replication_connection_configuration Table">
       <code class="literal">
        replication_connection_configuration
       </code>
      </a>
      Performance Schema table.
      <code class="literal">
       SOURCE_RETRY_COUNT
      </code>
      supersedes the
      <a class="link" href="replication-options-replica.html#option_mysqld_master-retry-count">
       <code class="option">
        --master-retry-count
       </code>
      </a>
      server
            startup option.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_ssl">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_ssl">
       <code class="literal">
        SOURCE_SSL = {0|1}
       </code>
      </a>
     </p>
     <p>
      Specify whether the replica encrypts the replication
            connection. The default is 0, meaning that the replica does
            not encrypt the replication connection. If you set
      <code class="literal">
       SOURCE_SSL=1
      </code>
      , you can configure the
            encryption using the
      <code class="literal">
       SOURCE_SSL_
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
      </code>
      and
      <code class="literal">
       SOURCE_TLS_
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
      </code>
      options.
     </p>
     <p>
      Setting
      <code class="literal">
       SOURCE_SSL=1
      </code>
      for a replication
            connection and then setting no further
      <code class="literal">
       SOURCE_SSL_
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
      </code>
      options corresponds to setting
      <code class="literal">
       --ssl-mode=REQUIRED
      </code>
      for the client, as
            described in
      <a class="xref" href="connection-options.html#encrypted-connection-options" title="Command Options for Encrypted Connections">
       Command Options for Encrypted Connections
      </a>
      .
            With
      <code class="literal">
       SOURCE_SSL=1
      </code>
      , the connection attempt
            only succeeds if an encrypted connection can be established.
            A replication connection does not fall back to an
            unencrypted connection, so there is no setting corresponding
            to the
      <code class="literal">
       --ssl-mode=PREFERRED
      </code>
      setting for
            replication. If
      <code class="literal">
       SOURCE_SSL=0
      </code>
      is set, this
            corresponds to
      <code class="literal">
       --ssl-mode=DISABLED
      </code>
      .
     </p>
     <div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Important
      </div>
      <p>
       To help prevent sophisticated man-in-the-middle attacks,
              it is important for the replica to verify the server’s
              identity. You can specify additional
       <code class="literal">
        SOURCE_SSL_
        <em class="replaceable">
         <code>
          xxx
         </code>
        </em>
       </code>
       options to correspond to the settings
       <code class="literal">
        --ssl-mode=VERIFY_CA
       </code>
       and
       <code class="literal">
        --ssl-mode=VERIFY_IDENTITY
       </code>
       , which are a
              better choice than the default setting to help prevent
              this type of attack. With these settings, the replica
              checks that the server’s certificate is valid, and
              checks that the host name the replica is using matches the
              identity in the server’s certificate. To implement one
              of these levels of verification, you must first ensure
              that the CA certificate for the server is reliably
              available to the replica, otherwise availability issues
              will result. For this reason, they are not the default
              setting.
      </p>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_ssl_xxx">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_ssl_xxx">
       <code class="literal">
        SOURCE_SSL_
        <em class="replaceable">
         <code>
          xxx
         </code>
        </em>
       </code>
      </a>
      ,
      <a class="link" href="change-replication-source-to.html#crs-opt-source_ssl_xxx">
       <code class="literal">
        SOURCE_TLS_
        <em class="replaceable">
         <code>
          xxx
         </code>
        </em>
       </code>
      </a>
     </p>
     <p>
      Specify how the replica uses encryption and ciphers to
            secure the replication connection. These options can be
            changed even on replicas that are compiled without SSL
            support. They are saved to the source metadata repository,
            but are ignored if the replica does not have SSL support
            enabled. The maximum length of the value for the
            string-valued
      <code class="literal">
       SOURCE_SSL_
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
      </code>
      and
      <code class="literal">
       SOURCE_TLS_
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
      </code>
      options is 511 characters, with the exception of
      <a class="link" href="change-replication-source-to.html#crs-opt-source_ssl_xxx">
       <code class="literal">
        SOURCE_TLS_CIPHERSUITES
       </code>
      </a>
      ,
            for which it is 4000 characters.
     </p>
     <p>
      The
      <code class="literal">
       SOURCE_SSL_
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
      </code>
      and
      <code class="literal">
       SOURCE_TLS_
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
      </code>
      options perform the same functions as the
      <code class="option">
       --ssl-
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
      </code>
      and
      <code class="option">
       --tls-
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
      </code>
      client
            options described in
      <a class="xref" href="connection-options.html#encrypted-connection-options" title="Command Options for Encrypted Connections">
       Command Options for Encrypted Connections
      </a>
      . The
            correspondence between the two sets of options, and the use
            of the
      <code class="literal">
       SOURCE_SSL_
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
      </code>
      and
      <code class="literal">
       SOURCE_TLS_
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
      </code>
      options to set up a secure connection, is explained in
      <a class="xref" href="replication-encrypted-connections.html" title="19.3.1 Setting Up Replication to Use Encrypted Connections">
       Section 19.3.1, “Setting Up Replication to Use Encrypted Connections”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_user">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_user">
       <code class="literal">
        SOURCE_USER =
            '
        <em class="replaceable">
         <code>
          user_name
         </code>
        </em>
        '
       </code>
      </a>
     </p>
     <p>
      The user name for the replication user account to use for
            connecting to the replication source server. The maximum
            length of the string value is 96 characters.
     </p>
     <p>
      For Group Replication, this account must exist on every
            member of the replication group. It is used for distributed
            recovery if the XCom communication stack is in use for the
            group, and also used for group communication connections if
            the MySQL communication stack is in use for the group. With
            the MySQL communication stack, the account must have the
      <a class="link" href="privileges-provided.html#priv_group-replication-stream">
       <code class="literal">
        GROUP_REPLICATION_STREAM
       </code>
      </a>
      permission.
     </p>
     <p>
      It is possible to set an empty user name by specifying
      <code class="literal">
       SOURCE_USER=''
      </code>
      , but the replication
            channel cannot be started with an empty user name. It is
            valid to set an empty
      <code class="literal">
       SOURCE_USER
      </code>
      user
            name and use the channel afterwards if you always provide
            user credentials using the
      <a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
       <code class="literal">
        START
            REPLICA
       </code>
      </a>
      statement or
      <a class="link" href="start-group-replication.html" title="15.4.3.1 START GROUP_REPLICATION Statement">
       <code class="literal">
        START
            GROUP_REPLICATION
       </code>
      </a>
      statement that starts the
            replication channel. This approach means that the
            replication channel always needs operator intervention to
            restart, but the user credentials are not recorded in the
            replication metadata repositories.
     </p>
     <div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Important
      </div>
      <p>
       To connect to the source using a replication user account
              that authenticates with the
       <code class="literal">
        caching_sha2_password
       </code>
       plugin, you must
              either set up a secure connection as described in
       <a class="xref" href="replication-encrypted-connections.html" title="19.3.1 Setting Up Replication to Use Encrypted Connections">
        Section 19.3.1, “Setting Up Replication to Use Encrypted Connections”
       </a>
       , or
              enable the unencrypted connection to support password
              exchange using an RSA key pair. The
       <code class="literal">
        caching_sha2_password
       </code>
       authentication
              plugin is the default for new users (see
       <a class="xref" href="caching-sha2-pluggable-authentication.html" title="8.4.1.2 Caching SHA-2 Pluggable Authentication">
        Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”
       </a>
       ).
              If the user account that you create or use for replication
              uses this authentication plugin, and you are not using a
              secure connection, you must enable RSA key pair-based
              password exchange for a successful connection. You can do
              this using either the
       <code class="literal">
        SOURCE_PUBLIC_KEY_PATH
       </code>
       option or the
       <code class="literal">
        GET_SOURCE_PUBLIC_KEY=1
       </code>
       option for this
              statement.
      </p>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a name="crs-opt-source_zstd_compression_level">
      </a>
      <a class="link" href="change-replication-source-to.html#crs-opt-source_zstd_compression_level">
       <code class="literal">
        SOURCE_ZSTD_COMPRESSION_LEVEL =
        <em class="replaceable">
         <code>
          level
         </code>
        </em>
       </code>
      </a>
     </p>
     <p>
      The compression level to use for connections to the
            replication source server that use the
      <code class="literal">
       zstd
      </code>
      compression algorithm. The permitted
            levels are from 1 to 22, with larger values indicating
            increasing levels of compression. The default level is 3.
     </p>
     <p>
      The compression level setting has no effect on connections
            that do not use
      <code class="literal">
       zstd
      </code>
      compression. For
            more information, see
      <a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
       Section 6.2.8, “Connection Compression Control”
      </a>
      .
     </p>
    </li>
   </ul>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="idm46045177168160">
       </a>
       Examples
      </h5>
     </div>
    </div>
   </div>
   <p>
    <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
     <code class="literal">
      CHANGE REPLICATION SOURCE TO
     </code>
    </a>
    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
    <code class="literal">
     CHANGE REPLICATION SOURCE TO
          SOURCE_LOG_FILE='
     <em class="replaceable">
      <code>
       log_name
      </code>
     </em>
     ',
          SOURCE_LOG_POS=
     <em class="replaceable">
      <code>
       log_pos
      </code>
     </em>
    </code>
    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:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa12723896"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CHANGE</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span>
  <span class="token keyword">SOURCE_HOST</span><span class="token operator">=</span><span class="token string">'source2.example.com'</span><span class="token punctuation">,</span>
  <span class="token keyword">SOURCE_USER</span><span class="token operator">=</span><span class="token string">'replication'</span><span class="token punctuation">,</span>
  <span class="token keyword">SOURCE_PASSWORD</span><span class="token operator">=</span><span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">,</span>
  <span class="token keyword">SOURCE_PORT</span><span class="token operator">=</span><span class="token number">3306</span><span class="token punctuation">,</span>
  <span class="token keyword">SOURCE_LOG_FILE</span><span class="token operator">=</span><span class="token string">'source2-bin.001'</span><span class="token punctuation">,</span>
  <span class="token keyword">SOURCE_LOG_POS</span><span class="token operator">=</span><span class="token number">4</span><span class="token punctuation">,</span>
  <span class="token keyword">SOURCE_CONNECT_RETRY</span><span class="token operator">=</span><span class="token number">10</span><span class="token punctuation">;</span></code></pre>
   </div>
   <p>
    For the procedure to switch an existing replica to a new
          source during failover, see
    <a class="xref" href="replication-solutions-switch.html" title="19.4.8 Switching Sources During Failover">
     Section 19.4.8, “Switching Sources During Failover”
    </a>
    .
   </p>
   <p>
    When GTIDs are in use on the source and the replica, specify
          GTID auto-positioning instead of giving the binary log file
          position, as in the following example. For full instructions
          to configure and start GTID-based replication on new or
          stopped servers, online servers, or additional replicas, see
    <a class="xref" href="replication-gtids.html" title="19.1.3 Replication with Global Transaction Identifiers">
     Section 19.1.3, “Replication with Global Transaction Identifiers”
    </a>
    .
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa73266379"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CHANGE</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span>
  <span class="token keyword">SOURCE_HOST</span><span class="token operator">=</span><span class="token string">'source3.example.com'</span><span class="token punctuation">,</span>
  <span class="token keyword">SOURCE_USER</span><span class="token operator">=</span><span class="token string">'replication'</span><span class="token punctuation">,</span>
  <span class="token keyword">SOURCE_PASSWORD</span><span class="token operator">=</span><span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">,</span>
  <span class="token keyword">SOURCE_PORT</span><span class="token operator">=</span><span class="token number">3306</span><span class="token punctuation">,</span>
  <span class="token keyword">SOURCE_AUTO_POSITION</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span>
  <span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">"source_3"</span><span class="token punctuation">;</span></code></pre>
   </div>
   <p>
    In this example, multi-source replication is in use, and the
    <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
     <code class="literal">
      CHANGE REPLICATION SOURCE TO
     </code>
    </a>
    statement is applied to the replication channel
    <code class="literal">
     "source_3"
    </code>
    that connects the replica to the
          specified host. For guidance on setting up multi-source
          replication, see
    <a class="xref" href="replication-multi-source.html" title="19.1.5 MySQL Multi-Source Replication">
     Section 19.1.5, “MySQL Multi-Source Replication”
    </a>
    .
   </p>
   <p>
    The next example shows how to make the replica apply
          transactions from relay log files that you want to repeat. To
          do this, the source need not be reachable. You can use
    <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
     <code class="literal">
      CHANGE REPLICATION SOURCE TO
     </code>
    </a>
    to
          locate the relay log position where you want the replica to
          start reapplying transactions, and then start the SQL thread:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33778499"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CHANGE</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span>
  <span class="token keyword">RELAY_LOG_FILE</span><span class="token operator">=</span><span class="token string">'replica-relay-bin.006'</span><span class="token punctuation">,</span>
  <span class="token keyword">RELAY_LOG_POS</span><span class="token operator">=</span><span class="token number">4025</span><span class="token punctuation">;</span>
<span class="token keyword">START</span> <span class="token keyword">REPLICA</span> <span class="token keyword">SQL_THREAD</span><span class="token punctuation">;</span></code></pre>
   </div>
   <p>
    <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
     <code class="literal">
      CHANGE REPLICATION SOURCE TO
     </code>
    </a>
    can also be used to skip over transactions in the binary log
          that are causing replication to stop. The appropriate method
          to do this depends on whether GTIDs are in use or not. For
          instructions to skip transactions using
    <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
     <code class="literal">
      CHANGE REPLICATION SOURCE TO
     </code>
    </a>
    or
          another method, see
    <a class="xref" href="replication-administration-skip.html" title="19.1.7.3 Skipping Transactions">
     Section 19.1.7.3, “Skipping Transactions”
    </a>
    .
   </p>
  </div>
 </div>
 <br/>
</div>
