<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="innodb-backup">
      </a>
      17.18.1 InnoDB Backup
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045149254624">
  </a>
  <a class="indexterm" name="idm46045149253136">
  </a>
  <p>
   The key to safe database management is making regular backups.
      Depending on your data volume, number of MySQL servers, and
      database workload, you can use these backup techniques, alone or
      in combination:
   <a class="link" href="glossary.html#glos_hot_backup" title="hot backup">
    hot backup
   </a>
   with
   <span class="emphasis">
    <em>
     MySQL Enterprise Backup
    </em>
   </span>
   ;
   <a class="link" href="glossary.html#glos_cold_backup" title="cold backup">
    cold backup
   </a>
   by copying
      files while the MySQL server is shut down;
   <a class="link" href="glossary.html#glos_logical_backup" title="logical backup">
    logical backup
   </a>
   with
   <a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
    <span class="command">
     <strong>
      mysqldump
     </strong>
    </span>
   </a>
   for smaller data volumes or to record
      the structure of schema objects. Hot and cold backups are
   <a class="link" href="glossary.html#glos_physical_backup" title="physical backup">
    physical backups
   </a>
   that
      copy actual data files, which can be used directly by the
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   server for faster restore.
  </p>
  <p>
   Using
   <span class="emphasis">
    <em>
     MySQL Enterprise Backup
    </em>
   </span>
   is the recommended method for
      backing up
   <code class="literal">
    InnoDB
   </code>
   data.
  </p>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    <code class="literal">
     InnoDB
    </code>
    does not support databases that are
        restored using third-party backup tools.
   </p>
  </div>
  <h4>
   <a name="idm46045149241264">
   </a>
   Hot Backups
  </h4>
  <p>
   The
   <span class="command">
    <strong>
     mysqlbackup
    </strong>
   </span>
   command, part of the MySQL Enterprise Backup
      component, lets you back up a running MySQL instance, including
   <code class="literal">
    InnoDB
   </code>
   tables, with minimal disruption to
      operations while producing a consistent snapshot of the database.
      When
   <span class="command">
    <strong>
     mysqlbackup
    </strong>
   </span>
   is copying
   <code class="literal">
    InnoDB
   </code>
   tables, reads and writes to
   <code class="literal">
    InnoDB
   </code>
   tables can continue. MySQL Enterprise Backup can also
      create compressed backup files, and back up subsets of tables and
      databases. In conjunction with the MySQL binary log, users can
      perform point-in-time recovery. MySQL Enterprise Backup is part of the MySQL
      Enterprise subscription. For more details, see
   <a class="xref" href="mysql-enterprise-backup.html" title="32.1 MySQL Enterprise Backup Overview">
    Section 32.1, “MySQL Enterprise Backup Overview”
   </a>
   .
  </p>
  <h4>
   <a name="idm46045149235344">
   </a>
   Cold Backups
  </h4>
  <p>
   If you can shut down the MySQL server, you can make a physical
      backup that consists of all files used by
   <code class="literal">
    InnoDB
   </code>
   to manage its tables. Use the following
      procedure:
  </p>
  <div class="orderedlist">
   <ol class="orderedlist" type="1">
    <li class="listitem">
     <p>
      Perform a
      <a class="link" href="glossary.html#glos_slow_shutdown" title="slow shutdown">
       slow
          shutdown
      </a>
      of the MySQL server and make sure that it
          stops without errors.
     </p>
    </li>
    <li class="listitem">
     <p>
      Copy all
      <code class="literal">
       InnoDB
      </code>
      data files
          (
      <code class="filename">
       ibdata
      </code>
      files and
      <code class="filename">
       .ibd
      </code>
      files) into a safe place.
     </p>
    </li>
    <li class="listitem">
     <p>
      Copy all
      <code class="literal">
       InnoDB
      </code>
      redo log files
          (
      <code class="filename">
       #ib_redo
       <em class="replaceable">
        <code>
         N
        </code>
       </em>
      </code>
      files) to a safe place.
     </p>
    </li>
    <li class="listitem">
     <p>
      Copy your
      <code class="filename">
       my.cnf
      </code>
      configuration file or
          files to a safe place.
     </p>
    </li>
   </ol>
  </div>
  <h4>
   <a name="idm46045149223648">
   </a>
   Logical Backups Using mysqldump
  </h4>
  <p>
   In addition to physical backups, it is recommended that you
      regularly create logical backups by dumping your tables using
   <a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
    <span class="command">
     <strong>
      mysqldump
     </strong>
    </span>
   </a>
   . A binary file might be corrupted
      without you noticing it. Dumped tables are stored into text files
      that are human-readable, so spotting table corruption becomes
      easier. Also, because the format is simpler, the chance for
      serious data corruption is smaller.
   <a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
    <span class="command">
     <strong>
      mysqldump
     </strong>
    </span>
   </a>
   also has a
   <a class="link" href="mysqldump.html#option_mysqldump_single-transaction">
    <code class="option">
     --single-transaction
    </code>
   </a>
   option for making a consistent snapshot without locking out other
      clients. See
   <a class="xref" href="backup-policy.html" title="9.3.1 Establishing a Backup Policy">
    Section 9.3.1, “Establishing a Backup Policy”
   </a>
   .
  </p>
  <p>
   Replication works with
   <a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
    <code class="literal">
     InnoDB
    </code>
   </a>
   tables,
      so you can use MySQL replication capabilities to keep a copy of
      your database at database sites requiring high availability. See
   <a class="xref" href="innodb-and-mysql-replication.html" title="17.19 InnoDB and MySQL Replication">
    Section 17.19, “InnoDB and MySQL Replication”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
