gpt4 book ai didi

MySQL恢复,包括binlog位置MASTER_LOG_POS

转载 作者:行者123 更新时间:2023-11-29 09:46:15 26 4
gpt4 key购买 nike

我像这样运行 MySQL 数据库转储:

mysqldump mydatabase -u root -p --single-transaction --events --routines --quick --master-data=2 --flush-logs --flush-privileges > mydump.sql

这将创建一个转储文件,其中包含以下行:

CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000008', MASTER_LOG_POS=120;

这告诉我任何新的更改都会从 mysql-bin.000008 开始记录

然后,在加载转储文件后,我可以像这样加载增量文件(假设在某个时刻也创建了 mysql-bin.000009):

mysqlbinlog mysql-bin.000008 mysql-bin.000009 | mysql -u root -p mydatabase

但是 MASTER_LOG_POS = 120 怎么样?我需要包含它吗?如果需要,如何包含?我的转储命令包含 --flush-logs,因此它应该启动一个全新的文件。

我正在阅读这里https://dev.mysql.com/doc/refman/5.7/en/backup-policy.html在这里https://dev.mysql.com/doc/refman/5.7/en/recovery-from-backups.html

最佳答案

https://dev.mysql.com/doc/refman/5.6/en/mysqlbinlog.html#option_mysqlbinlog_start-position说:

--start-position=N, -j N

Start reading the binary log at the first event having a position equal to or greater than N. This option applies to the first log file named on the command line.

This option is useful for point-in-time recovery.

关于MySQL恢复,包括binlog位置MASTER_LOG_POS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55602849/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com