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 initialization
130416 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檔案,導緻二進制日志為空。