master_password:表示实现复制的登录远程主机的密码
master_log_file:表示实现复制的binlog日志文件
master_log_pos:表示实现复制的binlog日志文件的偏移量
12、继续在从机执行操作,显示slave从机的状况,如下所示
?
start slave; Command(s) completed successfully.
mysql> SHOW SLAVE STATUS \G; *************************** 1. row *************************** Slave_IO_State: Master_Host: 192.168.1.100 Master_User: repl Master_Port: 3306 Connect_Retry: 60 Master_Log_File: binlog??00004 Read_Master_Log_Pos: 107 Relay_Log_File: Steven-PC-relay-bin.000002 Relay_Log_Pos: 4 Relay_Master_Log_File: binlog??00004 Slave_IO_Running: No Slave_SQL_Running: Yes Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 107 Relay_Log_Space: 107 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: NULL Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 1236 Last_IO_Error: Got fatal error 1236 from master when reading dat a from binary log: 'Could not find first log file name in binary log index file' Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1 1 row in set (0.00 sec) ERROR: No query specified
?
?
在上述执行show slave status \G命令中很显然存在一些问题,问题如下
?
Last_IO_Errno: 1236
Last_IO_Error: Got fatal error 1236 from master when reading dat
a from binary log: 'Could not find first log file name in binary log index file'
?
下面的步骤可以解决问题,具体步骤如下
1、重启master(192.168.1.100)主机的mysql服务,执行show master status \G命令
记下File和Position的值,后面slave主机会用到,命令执行如下
?
SHOW MASTER STATUS;
?

2、在slave(192.168.1.102)主机上重新设置信息,命令执行如下
?
stop slave;
change master to
master_log_file='binlog.000005',
master_log_pos=107;
start slave;
mysql> SHOW SLAVE STATUS \G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.1.100
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000005
Read_Master_Log_Pos: 107
Relay_Log_File: Steven-PC-relay-bin.000002
Relay_Log_Pos: 250
Relay_Master_Log_File: binlog.000005
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 107
Relay_Log_Space: 410
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
1 row in set (0.00 sec)
ERROR:
No query specified
?
这次正常了,实际上刚才有两个地方是错误的
第一个:在从机的my.ini里面
?
[mysql] default-character-set=utf8 #log_bin="C:/MYSQLLOG/binlog" #expire_logs_days=10 #max_binlog_size=100M
?
在从机的my.ini里面的mysql配置节下面配置了binlog,实际上这样做是错误的,要配置binlog需要在[mysqld]配置节下
第二个:第一次配