ERROR 1201 (HY000): Could not initialize master info structure

mysql主从不同步,手动同步时,出现的错误:

  
  
  1. mysql>stop slave;  
  2. mysql>change master to master_host='192.168.1.80',  
  3.  >master_user='admin',  
  4.  >master_password='123456',  
  5.  >master_log_file='mysql-bin.000519',  
  6.  >master_log_pos=107;  
  7. ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log 


根据网上前辈的们的解决方法有两种:一种是删除从服务器中继日志,二是reset slave。

1:查看错误日志
 

  
  
  1. [root@test mysql]# tail test.com.err  
  2. 121229 11:34:01 [ERROR] Could not find target log during relay log initialization  
  3. 121229 11:38:05 [ERROR] Failed to open the relay log './81-relay-bin.000047' (relay_log_pos 12247)  
  4. 121229 11:38:05 [ERROR] Could not find target log during relay log initialization 121229 11:42:51 [ERROR] Failed to open the relay log './81-relay-bin.000047'   
  5.  
  6. (relay_log_pos 12247)  
  7. 121229 11:42:51 [ERROR] Could not find target log during relay log initialization  
  8. 121229 11:42:54 [ERROR] Failed to open the relay log './81-relay-bin.000047' (relay_log_pos 12247)  
  9. 121229 11:42:54 [ERROR] Could not find target log during relay log initialization  
  10. 121229 11:44:41 [Note] 'CHANGE MASTER TO executed'. Previous state master_host='192.168.1.80'master_port='3306'master_log_file='',   
  11.  
  12. master_log_pos='4'. New state master_host='192.168.1.80'master_port='3306'master_log_file='mysql-bin.000583'master_log_pos='6682'.  
  13. 121229 11:44:52 [Note] Slave SQL thread initialized, starting replication in log'mysql-bin.000583' at position 6682, relay log './test-relay-bin.000001' position: 4  
  14.  

2:查看二进制日志信息
 

  
  
  1. [root@test mysql]# cat relay-log.info  
  2. ./test-relay-bin.000002  
  3. 253  
  4. mysql-bin.000583  
  5. 6682 


3:查看master信息
 

  
  
  1. [root@test mysql]# cat master.info  
  2. 18  
  3. mysql-bin.000583  
  4. 6682  
  5. 192.168.1.80  
  6. rep  
  7. 11111  
  8. 3306  
  9. 60  


第一种解决方法:
 

  
  
  1. [root@test mysql]#service mysqld stop   
  2. [root@test mysql]#rm -rf master.info  
  3. [root@test mysql]#rm -rf relay-log.info  
  4. [root@test mysql]#service mysqld start  
  5. mysql>change master to master_host='192.168.1.80',  
  6.  >master_user='admin',  
  7.  >master_password='123456',  
  8.  >master_log_file='mysql-bin.000519',  
  9.  >master_log_pos=107;  
  10. mysql>start slave;  


第二种解决方法:
 

  
  
  1. mysql> reset slave;  
  2. mysql>change master to master_host='192.168.1.80',  
  3.  >master_user='admin',  
  4.  >master_password='123456',  
  5.  >master_log_file='mysql-bin.000519',  
  6.  >master_log_pos=107;  
  7. mysql>start slave; 

 

本文出自 “-=湖边竹=-” 博客,请务必保留此出处http://bronte.blog.51cto.com/2418552/1103803

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值