mysql主从重置

在做mysql主从复制的时候,在从服务器上进行show slave status\G;查看时 Slave_IO_Running: No与Slave_SQL_Running: No,然后stop slave;后stat slave出现如下错误:

mysql> start slave;
ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log

解决方案:

mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)


mysql> reset slave;(reset重置)
Query OK, 0 rows affected (0.01 sec)


mysql> change master to master_host='192.168.10.155',master_user='slave1',master_password='123456',master_log_file='mysql-bin.000023',master_log_pos=107;
Query OK, 0 rows affected (0.01 sec)


mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

 

然后在执行show slave status\G;查看:

Slave_IO_Running: Yes
Slave_SQL_Running: Yes

这样就ok了,在网上查看出现这样的原始可能是以前的mysql做过主从!
---------------------
版权声明:本文为CSDN博主「Linux_newbie_rookie」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Linux_newbie_rookie/article/details/77568552

你可能感兴趣的:(mysql主从重置)