MySQL主从复制:ERROR 1201 (HY000): Could not initialize master info structure.

最近开始摸索MySQL主从复制,在测试环境进行了相关测试,也遇到了不少的坑。如在从库设置同步的时候,报如下错误:

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

出现这个错误的原因是因为从库之前已经做过主从复制,所以需要先停止从库,再进行从库同步设置。

具体的解决方法如下:

mysql> change master to master_host='192.168.1.51', master_user='replslave', master_password='replslave', master_log_file='mysql-bin-000002',master_log_pos=168;   
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='192.168.1.51', master_user='replslave', master_password='replslave', master_log_file='mysql-bin-000002',master_log_pos=168; 
Query OK, 0 rows affected (0.11 sec)  

Happy Coding.


转载请注明出处: @CSU-Max http://blog.csdn.net/csu_max
Max个人新博客:@MaxFang 重启型developer

你可能感兴趣的:(【---数据库---】)