目录
目录X
联系信息 首页 /正文内容

mysql 9.7.* 备份过程警告提示解决

AI摘要(BLUF)
问题描述:mysql 9.72版本的在数据库备份过程出现如下提示:Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. If you don't want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete dump, pass --all-d……

问题描述:
mysql 9.72版本的在数据库备份过程出现如下提示:

Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. If you don't want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete dump, pass --all-databases --triggers --routines --events. 

Warning: A dump from a server that has GTIDs enabled will by default include the GTIDs of all transactions, even those that were executed during its extraction and might not be represented in the dumped data. This might result in an inconsistent data dump. In order to ensure a consistent backup of the database, pass --single-transaction or --lock-all-tables or --source-data.


原因分析:

MySQL8.*:GTID 默认不是强制开启,且 mysqldump不会主动打印这两段 GTID 提示; 

MySQL9.x(含 9.7):gtid_mode 默认 ON,同时 mysqldump 客户端加强了告警逻辑:只要是单库部分备份(partial dump)+GTID 开启,就强制输出这两条 GTID 警告。

一句话:不是备份逻辑变了,是 9.7 的 mysqldump 把 GTID 部分备份风险,从隐性变成显式告警。


问题解决:

mysqldump 单库备份的时候增加下面俩个参数

--single-transaction: #InnoDB 在线热备,拿到一致性快照,不锁业务表;

--set-gtid-purged=OFF:#单库备份时,不导出 GTID 事务标记,消除 GTID 警告,恢复时避免 GTID 冲突。

整理后备份语句如下:

/data/mysql/bin/mysqldump  --set-gtid-purged=OFF --single-transaction

两个参数顺序无所谓,放前面后面都行。重新执行备份警告提示消除。问题解决

【打印正文】 发布时间:2026-09-16 15:10:59 浏览次数: 次 作者: 来源:本站原创