How do I backup a MySQL database?

前端 未结 5 930
日久生厌
日久生厌 2021-01-03 05:42

What do I have to consider when backing up a database with millions of entries? Are there any tools (maybe bundled with the MySQL server) that I could use?

5条回答
  •  南方客
    南方客 (楼主)
    2021-01-03 05:55

    Watch out if using mysqldump on large tables using the MyISAM storage engine; it blocks selects while the dump is running on each table and this can take down busy sites for 5-10 minutes in some cases.

    Using InnoDB, by comparison, you get non-blocking backups because of its row-level locking, so this is not such an issue.

    If you need to use MyISAM, a common strategy is to replicate to a second MySQL instance and do the mysqldump against the replicated copy instead.

提交回复
热议问题