<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="replication-multi-source-configuration">
      </a>
      19.1.5.1 Configuring Multi-Source Replication
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045145309984">
  </a>
  <p>
   A multi-source replication topology requires at least two sources
      and one replica configured. In these tutorials, we assume that you
      have two sources
   <code class="literal">
    source1
   </code>
   and
   <code class="literal">
    source2
   </code>
   , and a replica
   <code class="literal">
    replicahost
   </code>
   . The replica replicates one
      database from each of the sources,
   <code class="literal">
    db1
   </code>
   from
   <code class="literal">
    source1
   </code>
   and
   <code class="literal">
    db2
   </code>
   from
   <code class="literal">
    source2
   </code>
   .
  </p>
  <p>
   Sources in a multi-source replication topology can be configured
      to use either GTID-based replication, or binary log position-based
      replication. See
   <a class="xref" href="replication-gtids-howto.html" title="19.1.3.4 Setting Up Replication Using GTIDs">
    Section 19.1.3.4, “Setting Up Replication Using GTIDs”
   </a>
   for how
      to configure a source using GTID-based replication. See
   <a class="xref" href="replication-howto-masterbaseconfig.html" title="19.1.2.1 Setting the Replication Source Configuration">
    Section 19.1.2.1, “Setting the Replication Source Configuration”
   </a>
   for how to
      configure a source using file position based replication.
  </p>
  <p>
   Replicas in a multi-source replication topology require
   <code class="literal">
    TABLE
   </code>
   repositories for the replica's connection
      metadata repository and applier metadata repository, which are the
      default in MySQL 8.4. Multi-source replication is not
      compatible with the deprecated alternative file repositories.
  </p>
  <p>
   Create a suitable user account on all the sources that the replica
      can use to connect. You can use the same account on all the
      sources, or a different account on each. If you create an account
      solely for the purposes of replication, that account needs only
      the
   <a class="link" href="privileges-provided.html#priv_replication-slave">
    <code class="literal">
     REPLICATION SLAVE
    </code>
   </a>
   privilege.
      For example, to set up a new user,
   <code class="literal">
    ted
   </code>
   , that
      can connect from the replica
   <code class="literal">
    replicahost
   </code>
   , use
      the
   <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
    <span class="command">
     <strong>
      mysql
     </strong>
    </span>
   </a>
   client to issue these statements on
      each of the sources:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42733034"><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">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'ted'</span>@<span class="token string">'replicahost'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">GRANT</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">SLAVE</span> <span class="token keyword">ON</span> <span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> <span class="token string">'ted'</span>@<span class="token string">'replicahost'</span><span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   For more information about the default authentication plugin for
      new users, see
   <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>
   .
  </p>
 </div>
 <br/>
</div>
