MySQL 实验室 因为专注,所以专业。

  • 首页
  • 博客
  • 下载
  • 文档
  • 工具
  • 知识库
  • 培训及服务
  • MySQL 5.1 Reference Manual :: 6 Backup and Recovery
    • MySQL 5.1 Reference Manual
    • Preface, Notes, Licenses
    • 1 General Information
    • 2 Installing and Upgrading MySQL
    • 3 Tutorial
    • 4 MySQL Programs
    • 5 MySQL Server Administration
    • 6 Backup and Recovery
    • 7 Optimization
    • 8 Language Structure
    • 9 Internationalization and Localization
    • 10 Data Types
    • 11 Functions and Operators
    • 12 SQL Statement Syntax
    • 13 Storage Engines
    • 14 High Availability and Scalability
    • 15 MySQL Enterprise Monitor
    • 16 Replication
    • 17 MySQL Cluster NDB 6.X/7.X
    • 18 Partitioning
    • 19 Stored Programs and Views
    • 20 INFORMATION_SCHEMA Tables
    • 21 Connectors and APIs
    • 22 Extending MySQL
    • A MySQL 5.1 Frequently Asked Questions
    • B Errors, Error Codes, and Common Problems
    • C MySQL Change History
    • D Restrictions and Limits
    • Index
    • Standard Index
    • C Function Index
    • Command Index
    • Function Index
    • INFORMATION_SCHEMA Index
    • Transaction Isolation Level Index
    • JOIN Types Index
    • Operator Index
    • Option Index
    • Privileges Index
    • SQL Modes Index
    • Status Variable Index
    • Statement/Syntax Index
    • System Variable Index

    Chapter 6. Backup and Recovery

    Table of Contents     [+/-]

    6.1. Backup and Recovery Types
    6.2. Database Backup Methods
    6.3. Example Backup and Recovery Strategy     [+/-]
    6.3.1. Backup Policy
    6.3.2. Using Backups for Recovery
    6.3.3. Backup Strategy Summary
    6.4. Using mysqldump for Backups     [+/-]
    6.4.1. Dumping Data in SQL Format with mysqldump
    6.4.2. Reloading SQL-Format Backups
    6.4.3. Dumping Data in Delimited-Text Format with mysqldump
    6.4.4. Reloading Delimited-Text Format Backups
    6.4.5. mysqldump Tips
    6.5. Point-in-Time (Incremental) Recovery Using the Binary Log     [+/-]
    6.5.1. Point-in-Time Recovery Using Event Times
    6.5.2. Point-in-Time Recovery Using Event Positions
    6.6. MyISAM Table Maintenance and Crash Recovery     [+/-]
    6.6.1. Using myisamchk for Crash Recovery
    6.6.2. How to Check MyISAM Tables for Errors
    6.6.3. How to Repair MyISAM Tables
    6.6.4. MyISAM Table Optimization
    6.6.5. Setting Up a MyISAM Table Maintenance Schedule

    It is important to back up your databases so that you can recover your data and be up and running again in case problems occur, such as system crashes, hardware failures, or users deleting data by mistake. Backups are also essential as a safeguard before upgrading a MySQL installation, and they can be used to transfer a MySQL installation to another system or to set up replication slave servers.

    MySQL offers a variety of backup strategies from which you can choose the methods that best suit the requirements for your installation. This chapter discusses several backup and recovery topics with which you should be familiar:

    • Types of backups: Logical versus physical, full versus incremental, and so forth

    • Methods for creating backups

    • Recovery methods, including point-in-time recovery

    • Backup scheduling, compression, and encryption

    • Table maintenance, to enable recovery of corrupt tables

    Additional Resources

    Resources related to backup or to maintaining data availability include the following:

    • A forum dedicated to backup issues is available at http://forums.mysql.com/list.php?93.

    • Details for mysqldump, mysqlhotcopy, and other MySQL backup programs can be found in Chapter 4, MySQL Programs.

    • The syntax of the SQL statements described here is given in Chapter 12, SQL Statement Syntax.

    • For additional information about InnoDB backup procedures, see Section 13.6.6, “Backing Up and Recovering an InnoDB Database”.

    • Replication enables you to maintain identical data on multiple servers. This has several benefits, such as allowing client query load to be distributed over servers, availability of data even if a given server is taken offline or fails, and the ability to make backups with no impact on the master by using a slave server. See Chapter 16, Replication.

    • MySQL Cluster provides a high-availability, high-redundancy version of MySQL adapted for the distributed computing environment. See Chapter 17, MySQL Cluster NDB 6.X/7.X. For information specifically about MySQL Cluster backup, see Section 17.5.3, “Online Backup of MySQL Cluster”.

    • Distributed Replicated Block Device (DRBD) is another high-availability solution. It works by replicating a block device from a primary server to a secondary server at the block level. See Chapter 14, High Availability and Scalability