<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="binary-log-formats">
      </a>
      7.4.4.1 Binary Logging Formats
     </h4>
    </div>
   </div>
  </div>
  <p>
   The server uses several logging formats to record information in
        the binary log:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      Replication capabilities in MySQL originally were based on
            propagation of SQL statements from source to replica. This
            is called
      <span class="emphasis">
       <em>
        statement-based logging
       </em>
      </span>
      . You
            can cause this format to be used by starting the server with
      <a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
       <code class="option">
        --binlog-format=STATEMENT
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      In
      <span class="emphasis">
       <em>
        row-based logging
       </em>
      </span>
      (the default), the
            source writes events to the binary log that indicate how
            individual table rows are affected. You can cause the server
            to use row-based logging by starting it with
      <a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
       <code class="option">
        --binlog-format=ROW
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      A third option is also available:
      <span class="emphasis">
       <em>
        mixed
            logging
       </em>
      </span>
      . With mixed logging, statement-based
            logging is used by default, but the logging mode switches
            automatically to row-based in certain cases as described
            below. You can cause MySQL to use mixed logging explicitly
            by starting
      <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
       <span class="command">
        <strong>
         mysqld
        </strong>
       </span>
      </a>
      with the option
      <a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
       <code class="option">
        --binlog-format=MIXED
       </code>
      </a>
      .
     </p>
    </li>
   </ul>
  </div>
  <p>
   The logging format can also be set or limited by the storage
        engine being used. This helps to eliminate issues when
        replicating certain statements between a source and replica
        which are using different storage engines.
  </p>
  <p>
   With statement-based replication, there may be issues with
        replicating nondeterministic statements. In deciding whether or
        not a given statement is safe for statement-based replication,
        MySQL determines whether it can guarantee that the statement can
        be replicated using statement-based logging. If MySQL cannot
        make this guarantee, it marks the statement as potentially
        unreliable and issues the warning,
   <span class="errortext">
    Statement may not
        be safe to log in statement format
   </span>
   .
  </p>
  <p>
   You can avoid these issues by using MySQL's row-based
        replication instead.
  </p>
 </div>
 <br/>
</div>
