1. 程式人生 > >mysqldump匯出資料出現問題

mysqldump匯出資料出現問題

利用mysqldump匯出資料時提示warning,A partial dump from a server that has GTIDs
[email protected]:~$  mysqldump -uroot -p sdxdb > sdxdb.sql
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.

關於GTID是5.6以後,加入了全域性事務 ID (GTID) 來強化資料庫的主備一致性,故障恢復,以及容錯能力。
官方給的:A global transaction identifier (GTID) is a unique identifier created and associated with each transaction committed on the server of origin (master).
所以可能是因為在一個數據庫裡面唯一,但是當匯入其他的庫就有可能重複。所有會有一個提醒。

可以通過新增--set-gtid-purged=off 或者–gtid-mode=OFF這兩個引數設定。
很有肯能是在匯入庫中重新生產GTID,而不用原來的。

[email protected]:~$ mysqldump -uroot --set-gtid-purged=off -p sdxdb > sdxdb.sql                      #這樣就ok了!