mysql主从断掉后,恢复

主库:10.0.2.75;从库:10.0.2.230;

mysql> show slave status\G;

mysql主从断掉后,恢复_第1张图片

mysql> flush tables with read lock\G

mysql> show master status\G

mysql主从断掉后,恢复_第2张图片

mysql> change master to master_host='10.0.2.230', master_user='root', master_password='123456', master_log_file='mysql-bin.000005', master_log_pos=625;

###mater_log_file和master_log_pos的值是在从库上执行show master status的结果

mysql> start slave;

出现报错;处理;

mysql> reset slave;

重新配置;

mysql> change master to master_host='10.0.2.230', master_user='root', master_password='123456', master_log_file='mysql-bin.000005', master_log_pos=625;

mysql> start slave;

mysql> show slave status\G;

mysql主从断掉后,恢复_第3张图片

主库成功;开始配置从库;

mysql> flush tables with read lock\G

mysql> show master status\G

mysql主从断掉后,恢复_第4张图片

mysql> change master to master_host='10.0.2.75', master_user='root', master_password='123456', master_log_file='mysql-bin.000008', master_log_pos=639208;

###mater_log_file和master_log_pos的值是在主库上执行show master status的结果

mysql>  start slave;

mysql> reset slave;

mysql> change master to master_host='10.0.2.75', master_user='root', master_password='123456', master_log_file='mysql-bin.000008', master_log_pos=639208;

mysql>  start slave;

mysql> show slave status\G

mysql主从断掉后,恢复_第5张图片

mysql> UNLOCK TABLES;

你可能感兴趣的:(mysql)