gpt4 book ai didi

mysql - 在 MySQL 数据库中备份新数据

转载 作者:太空宇宙 更新时间:2023-11-03 11:45:26 24 4
gpt4 key购买 nike

我有一个 MySQL 数据库,其中包含一些表,每天都会向每个表添加一些记录。我开发了一个包含 mysqldump 命令的 shell 脚本 来每天从每个表中的第一条记录开始备份这个数据库。我想知道是否有一种方法可以备份数据库中新生成的数据,而不是第一条记录中的所有数据。

最佳答案

根据 Backup and Recovery Types 记录:

Making Incremental Backups by Enabling the Binary Log

MySQL supports incremental backups: You must start the server with the --log-bin option to enable binary logging; see Section 6.4.4, “The Binary Log”. The binary log files provide you with the information you need to replicate changes to the database that are made subsequent to the point at which you performed a backup. At the moment you want to make an incremental backup (containing all changes that happened since the last full or incremental backup), you should rotate the binary log by using FLUSH LOGS. This done, you need to copy to the backup location all binary logs which range from the one of the moment of the last full or incremental backup to the last but one. These binary logs are the incremental backup; at restore time, you apply them as explained in Section 8.5, “Point-in-Time (Incremental) Recovery Using the Binary Log”. The next time you do a full backup, you should also rotate the binary log using FLUSH LOGS or mysqldump --flush-logs. See Section 5.5.4, “mysqldump — A Database Backup Program”.

关于mysql - 在 MySQL 数据库中备份新数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39223339/

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