mysql> flush tables with read lock;
/usr/local/mysql/bin/mysqldump -uroot -p test> test.sql
mysql> show master status; +------------------+-----------+--------------+------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +------------------+-----------+--------------+------------------+-------------------+ | mysql-bin.000010 | 179567203 | | | | +------------------+-----------+--------------+------------------+-------------------+
mysql> stop slave;
mysql> source test.sql;
CHANGE MASTER TO MASTER_HOST='172.16.2.216',MASTER_USER='repl',MASTER_PASSWORD='123456',MASTER_PORT=3306,MASTER_LOG_FILE='mysql-bin.000010', MASTER_LOG_POS=179567203;
mysql> start slave;
mysql> show slave status\G
mysql> UNLOCK TABLES;