在主库上全量备份
#mysqldump -uroot -p --master-data=2 --default-character-set=utf8 test > test.sql
#head -n 30 备份日志文件 可以看到备份时binlog的点
从库上操作
#mysql -uroot -p
mysql> stop slave;
在从库上恢复全量备份
#mysql -uroot -p
#mysql -uroot -p --default-character-set=utf8 test< test.sql
从库上重做主从关系
#mysql -uroot -p
mysql>change master to master_host=‘主库ip’,master_user=‘slave’,master_password=‘passwd’,master_log_file=‘mysql-bin.000025’,master_log_pos=22232;
mysql > start slave;
mysql > show slave status\G;
观察Seconds_Behind_Masterde的值 ,变成0就是同步完成了