Fixing MySQL Slave_IO_Running: No

If you encounter Slave_IO_Running: No but Slave_SQL_Running: Yes in MySQL replication setup, here may have something that can help.

mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
             Slave_IO_State:
                Master_Host: 192.168.58.13
                Master_User: rep
                Master_Port: 3306
              Connect_Retry: 60
            Master_Log_File: master-bin.000052
        Read_Master_Log_Pos: 11114210
             Relay_Log_File: slave-relay-bin.000001
              Relay_Log_Pos: 373226
      Relay_Master_Log_File: master-bin.000052
           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: 9697034
            Relay_Log_Space: 1790402
            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: 14431
1 row in set (0.00 sec)

This basically means that the slave server is working, but for some reason the master does not send anything to the slave. To troubleshoot this problem, go to the master server instead and check the error log. In my case, this is what I found.

[root@master mysql]# tail master.err
120220 10:11:45  Failed to open log (file './master-bin.000050', errno 13)

In my case, the file master-bin.000050 is actually there, but the owner is root which therefore cannot be opened by the account mysql. Most likely it is because someone started MySQL using the root account after a server down and later on someone restarted the MySQL again under the mysql account. Anyway changed the owner of the file and problem fixed.

Advertisements