MySQL同步故障:" Slave_SQL_Running:No" 两种解决办法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhao3587717/article/details/83576806

MySQL同步故障:" Slave_SQL_Running:No" 两种解决办法


使用中出现了这种情况,经过一番查找,终于解决
首先停掉Slave服务:slave stop
到主服务器上查看主机状态:
记录File和Position对应的值

进入master

mysql> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000003 |     8935 | test1        | jzsoft           |
+------------------+----------+--------------+------------------+

然后到slave服务器上执行手动同步:

mysql> change master to master_host='10.10.5.180',master_user='slave',master_pas
sword='123456',master_log_file='mysql-bin.000003',master_log_pos=8935;
mysql> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.10.5.180
                  Master_User: slave
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000003
          Read_Master_Log_Pos: 8935
               Relay_Log_File: relay-bin.000002
                Relay_Log_Pos: 253
        Relay_Master_Log_File: mysql-bin.000003
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: test1
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0

手动同步需要停止master的写操作!

mysql> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.10.5.180
                  Master_User: slave
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000003
          Read_Master_Log_Pos: 8935
               Relay_Log_File: relay-bin.000002
                Relay_Log_Pos: 253
        Relay_Master_Log_File: mysql-bin.000003
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: test1
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0

成功解决,这里参考了他人的博文
链接: MySQL同步故障:" Slave_SQL_Running:No" 两种解决办法.

猜你喜欢

转载自blog.csdn.net/zhao3587717/article/details/83576806