1.导出时指定字符集,报错Character set 'utf-8' is not a compiled character set and is not specifie .
--default-character-set=utf-8
这个是因为字符集错了。是--default-character-set=utf8
2,导出时提示warning,A partial dump from a server that has GTIDs
[root@localhost data]# mysqldump -uroot --master-data=2 -p --single-transaction --databases test >3.sqlEnter password: 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,而不用原来的。
# mysqldump uroot a server that has GTIDs will include the GTIDs transactions, even those that changed suppressed parts the . you don
不增加 GLOBAL.GTID_PURGED 变量
[root@localhost data]# mysqldump -uroot --master-data=2 -p --single-transaction --set-gtid-purged=OFF --databases test >3.sql
导出数据库TEST中的t表 db1 table1
[root@localhost data]# mysqldump -uroot --master-data=2 -p --single-transaction --set-gtid-purged=OFF test t >3.sql
指定TEST ,TEST1数据库的导出 --databases db1 db2
[root@localhost data]# mysqldump -uroot --master-data=2 -p --single-transaction --set-gtid-purged=OFF --databases test test1 >3.sqlEnter password:
全备数据库 --all-databases
[root@localhost data]# mysqldump -uroot --master-data=2 -p --single-transaction --set-gtid-purged=OFF --all-databases
大数据量备份 -q
[root@localhost data]# mysqldump -uroot --master-data=2 -p --single-transaction -q --set-gtid-purged=OFF test t >3.sql Enter password: