<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="replication-howto-slaveinit">
      </a>
      19.1.2.7 Setting the Source Configuration on the Replica
     </h4>
    </div>
   </div>
  </div>
  <p>
   To set up the replica to communicate with the source for
        replication, configure the replica with the necessary connection
        information. To do this, on the replica, execute the following
   <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, replacing the option values with the actual values
        relevant to your system:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa81183765"><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 prompt">mysql&gt;</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 prompt">    -&gt;</span>     <span class="token keyword">SOURCE_HOST</span><span class="token operator">=</span><span class="token string">'<em class="replaceable">source_host_name</em>'</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>     <span class="token keyword">SOURCE_USER</span><span class="token operator">=</span><span class="token string">'<em class="replaceable">replication_user_name</em>'</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>     <span class="token keyword">SOURCE_PASSWORD</span><span class="token operator">=</span><span class="token string">'<em class="replaceable">replication_password</em>'</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>     <span class="token keyword">SOURCE_LOG_FILE</span><span class="token operator">=</span><span class="token string">'<em class="replaceable">recorded_log_file_name</em>'</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>     <span class="token keyword">SOURCE_LOG_POS</span><span class="token operator">=</span><em class="replaceable">recorded_log_position</em><span class="token punctuation">;</span></code></pre>
  </div>
  <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 source MySQL server using TCP/IP.
   </p>
  </div>
  <p>
   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 has other options as well. For example, it is possible
        to set up secure replication using SSL. For a full list of
        options, and information about the maximum permissible length
        for the string-valued options, see
   <a class="xref" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
    Section 15.4.2.2, “CHANGE REPLICATION SOURCE TO Statement”
   </a>
   .
  </p>
  <div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Important
   </div>
   <p>
    As noted in
    <a class="xref" href="replication-howto-repuser.html" title="19.1.2.3 Creating a User for Replication">
     Section 19.1.2.3, “Creating a User for Replication”
    </a>
    , if
          you are not using a secure connection and the user account
          named in the
    <code class="literal">
     SOURCE_USER
    </code>
    option
          authenticates with the
    <code class="literal">
     caching_sha2_password
    </code>
    plugin (the default
          in MySQL 8.4), you must specify the
    <code class="literal">
     SOURCE_PUBLIC_KEY_PATH
    </code>
    or
    <code class="literal">
     GET_SOURCE_PUBLIC_KEY
    </code>
    option 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 to enable RSA key pair-based password exchange.
   </p>
  </div>
 </div>
 <br/>
</div>
