ERROR 1201 (HY000):Could not initialize master info structure,ERROR 29 (HY000): File'./web_appdb_的问题

 
今天在做MySQL主从复制时遇到个ERROR 1201 (HY000): Could not initialize master info structure .
出现这个问题的原因是之前曾做过主从复制!
  www.2cto.com  
解决方案是:运行命令 stop slave;
成功执行后继续运行 reset slave;
然后进行运行GRANT命令重新设置主从复制。
具体过程如下:
Command代码  
mysql> change master to master_host='127.0.0.1', master_user='user', master_pass  
word='user', master_log_file='mysql-bin-000202', master_log_pos=553;  
ERROR 1201 (HY000): Could not initialize master info structure; more error messa  
ges can be found in the MySQL error log  
mysql> stop slave;  
Query OK, 0 rows affected, 1 warning (0.00 sec)  
  
mysql> reset slave;  
Query OK, 0 rows affected (0.00 sec)  
  
mysql> change master to master_host='127.0.0.1', master_user='user', master_pass  
word='user', master_log_file='mysql-bin-000202', master_log_pos=553;  
Query OK, 0 rows affected (0.11 sec)  
假如报错:

ERROR 29 (HY000): File'./web_appdb_1-relay-bin.000376' not found (Errcode: 2)

报错原因:中继日志索引文件中存在很多中继日志记录,但是那些中继日志物理上被删除了。

解决办法:备份下中继日志索引文件,并清空中继日志索引文件,然后再reset slave。

[root@web_appdb_1 mysql]# cpweb_appdb_1-relay-bin.index web_appdb_1-relay-bin.index_bak

[root@web_appdb_1 mysql]# true >web_appdb_1-relay-bin.index

mysql> reset slave;

Query OK, 0 rows affected (0.00 sec)

 mysql> CHANGE MASTER TOMASTER_USER='RepUser',MASTER_HOST='10.0.3.117',MASTER_PASSWORD='Mysql_yunmenhu',MASTER_PORT=3306,MASTER_LOG_FILE='mysql-bin.048379',MASTER_LOG_POS=2740; 

Query OK, 0 rows affected (0.02 sec)

 

mysql> start slave;

Query OK, 0 rows affected (0.01 sec)


--本篇文章转自: http://www.2cto.com/database/201301/185975.html

你可能感兴趣的:(1,MySql,学习,#,Mysql,主从复制,#,MySql,报错集锦)