<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="replication-features-reserved-words">
      </a>
      19.5.1.26 Replication and Reserved Words
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045135235328">
  </a>
  <a class="indexterm" name="idm46045135233840">
  </a>
  <p>
   You can encounter problems when you attempt to replicate from an
        older source to a newer replica and you make use of identifiers
        on the source that are reserved words in the newer MySQL version
        running on the replica. For example, a table column named
   <code class="literal">
    rank
   </code>
   on a MySQL 5.7 source that is
        replicating to a MySQL 8.4 replica could cause a
        problem because
   <code class="literal">
    RANK
   </code>
   became a reserved word
        in MySQL 8.0.
  </p>
  <p>
   Replication can fail in such cases with Error 1064
   <span class="errortext">
    You have an error in your SQL syntax...
   </span>
   ,
   <span class="emphasis">
    <em>
     even if a database or table named using the reserved
        word or a table having a column named using the reserved word is
        excluded from replication
    </em>
   </span>
   . This is due to the fact
        that each SQL event must be parsed by the replica prior to
        execution, so that the replica knows which database object or
        objects would be affected. Only after the event is parsed can
        the replica apply any filtering rules defined by
   <a class="link" href="replication-options-replica.html#option_mysqld_replicate-do-db">
    <code class="option">
     --replicate-do-db
    </code>
   </a>
   ,
   <a class="link" href="replication-options-replica.html#option_mysqld_replicate-do-table">
    <code class="option">
     --replicate-do-table
    </code>
   </a>
   ,
   <a class="link" href="replication-options-replica.html#option_mysqld_replicate-ignore-db">
    <code class="option">
     --replicate-ignore-db
    </code>
   </a>
   , and
   <a class="link" href="replication-options-replica.html#option_mysqld_replicate-ignore-table">
    <code class="option">
     --replicate-ignore-table
    </code>
   </a>
   .
  </p>
  <p>
   To work around the problem of database, table, or column names
        on the source which would be regarded as reserved words by the
        replica, do one of the following:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      Use one or more
      <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
       <code class="literal">
        ALTER TABLE
       </code>
      </a>
      statements on the source to change the names of any database
            objects where these names would be considered reserved words
            on the replica, and change any SQL statements that use the
            old names to use the new names instead.
     </p>
    </li>
    <li class="listitem">
     <p>
      In any SQL statements using these database object names,
            write the names as quoted identifiers using backtick
            characters (
      <code class="literal">
       `
      </code>
      ).
     </p>
    </li>
   </ul>
  </div>
  <p>
   For listings of reserved words by MySQL version, see
   <a class="ulink" href="/doc/mysqld-version-reference/en/keywords-8-0.html" target="_top">
    Keywords and Reserved Words in MySQL 8.0
   </a>
   , in the
   <em class="citetitle">
    MySQL Server
        Version Reference
   </em>
   . For identifier quoting rules, see
   <a class="xref" href="identifiers.html" title="11.2 Schema Object Names">
    Section 11.2, “Schema Object Names”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
