show slave status\G;
发现: Slave_IO_Running: NO
Slave_SQL_Running: No
也不能启动slave
mysql> slave start;
ERROR 1201 (HY000): Could not initialize master info structure; more error messagescan be found in the MySQL error log
打开/usr/local/mysql/datat/.err错误日志文件:
130416 14:03:54 [ERROR] Failed to open the relay log './localhost-relay-bin.000002' (relay_log_pos 253)
130416 14:03:54 [ERROR] Could not find target log during relay log initialization130416 14:03:54 [ERROR] Failed to initialize the master info structure
解决方法:
删除所有文件名包含relay的文件,relay-log.info,relay-bin.index,relay-bin.xxxxxx文件。
1)关闭mysql,
#/etc/init.d/mysqld stop
2)删除relay文件
#rm -f *relay*
3)登录mysql,启动slave
#mysql -uroot -p
mysql>slave start
mysql>show slave status\G
引起的原因:修改了centos的主机名,找不到relay-bin.index文件,导致二进制日志为空。