一、配置mysql gtid下主从复制
master库192.195.1.131操作:
[root@VM_82_178_centos ~]# mysql -e "grant replication slave on *.* to rep@'192.195.1.233' identified by '23458&34%'; flush privileges;"
[root@VM_82_178_centos ~]# mysqldump -uroot -p'jianwuweirootmysql' -B -A -F --master-data=2 --single-transaction --events|gzip >/opt/test_$(date +%F).sql.gz
mysqldump: [Warning] Using a password on the command line interface can be insecure.
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.
slave库192.195.1.233操作:
root@localhost [(none)]>show master status;
+------------------+----------+--------------+------------------+------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+------------------------------------------+<