简体   繁体   English

备份mysql二进制文件

[英]backup mysql binary files

I need to know if this is the correct way (not losing written data while backing up) to backup the binary files? 我需要知道这是否是正确的方法(备份时不丢失写入数据)备份二进制文件?

1. 1。

LOCK TABLES
    tbl_0 READ,
    tbl_1 READ,
    tbl_2 READ

FLUSH TABLES WITH READ LOCK

2. 2。

copy *.frm, *.myd, *.myi files

3. 3。

UNLOCK TABLES

It is not sufficient to do this. 这样做是不够的。

The best is to shut the database down completely, and copy the entire contents of the data directory. 最好是完全关闭数据库,并复制数据目录的全部内容。

Alternatively, you may leave the database running and take an atomic filesystem snapshot. 或者,您可以保持数据库运行并拍摄原子文件系统快照。

If you are sure that you only use MyISAM tables (and InnoDB is completely disabled in your system, as are other engines), you CAN potentially take a dump under a global lock taken with "FLUSH TABLES WITH READ LOCK". 如果您确定只使用MyISAM表(并且InnoDB在您的系统中完全禁用,就像其他引擎一样),您可以在使用“FLUSH TABLES WITH READ LOCK”的全局锁定下进行转储。 This does impact the system but it's not as bad as a shutdown. 这确实会影响系统,但不如关机严重。

Note that if you have any InnoDB tables - any at all, present anywhere in the server - then you can't take a backup this way. 请注意,如果您有任何InnoDB表 - 任何表,存在于服务器中的任何位置 - 那么您就不能以这种方式进行备份。 "FLUSH TABLES WITH READ LOCK" is not sufficient to backup innodb. “具有READ LOCK的FLUSH表”不足以备份innodb。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM