Wednesday 7 November 2012

Mysql Tips: how to fix Slave_SQL_Running: No to fix replication


How to fix Slave_SQL_Running: No to fix replication


mysql -u root -p

mysql> SHOW SLAVE STATUS \G
mysql> SHOW SLAVE STATUS \G
*************************** 1. row ***************************
             Slave_IO_State: Waiting for master to send event
                Master_Host: 1.2.3.4
                Master_User: slave_user
                Master_Port: 3306
              Connect_Retry: 60
            Master_Log_File: mysql-bin.001079
        Read_Master_Log_Pos: 269214454
             Relay_Log_File: slave-relay.000130
              Relay_Log_Pos: 100125935
      Relay_Master_Log_File: mysql-bin.001079
           Slave_IO_Running: Yes
          Slave_SQL_Running: No

 Repairing The Replication

Just to go sure, we stop the slave:
mysql> STOP SLAVE;
Fixing the problem is actually quite easy. We tell the slave to simply skip the invalid SQL query:
mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
This tells the slave to skip one query (which is the invalid one that caused the replication to stop). If you'd like to skip two queries, you'd use SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 2; instead and so on.
That's it already. Now we can start the slave again...
mysql> START SLAVE;
... and check if replication is working again:
mysql> SHOW SLAVE STATUS \G
mysql> SHOW SLAVE STATUS \G
*************************** 1. row ***************************
             Slave_IO_State: Waiting for master to send event
                Master_Host: 1.2.3.4
                Master_User: slave_user
                Master_Port: 3306
              Connect_Retry: 60
            Master_Log_File: mysql-bin.001079
        Read_Master_Log_Pos: 447560366
             Relay_Log_File: slave-relay.000130
              Relay_Log_Pos: 225644062
      Relay_Master_Log_File: mysql-bin.001079
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes
            Replicate_Do_DB: mydb

2 comments:

  1. NOW THE STATE IS

    Slave_IO_Running: NO
    Slave_SQL_Running: Yes

    ReplyDelete
  2. The Linux Stuff: Mysql Tips: How To Fix Slave_Sql_Running: No To Fix Replication >>>>> Download Now

    >>>>> Download Full

    The Linux Stuff: Mysql Tips: How To Fix Slave_Sql_Running: No To Fix Replication >>>>> Download LINK

    >>>>> Download Now

    The Linux Stuff: Mysql Tips: How To Fix Slave_Sql_Running: No To Fix Replication >>>>> Download Full

    >>>>> Download LINK IF

    ReplyDelete