Master slave 复制错误
Description:
Slave_IO_Running:NO
Slave_SQL_Running:Yes
Seconds_Behind_Master: NULL
本人遇到的Slave_IO_Running:NO的情况有下面两种:
1. 在配置slave同步时因为slave访问master没有权限导致;
2. master上的mysql-bin.xxxxxx文件全被我误删除了;
对于第一种情况,仔细检查数据库访问权限即可解决;
对于第二种情况,下面稍微详细介绍一下:
mysql> show slave status\G
*************************** 1. row ***************************
             Slave_IO_State: 
                Master_Host: 192.168.3.21
                Master_User: slave
                Master_Port: 3307
              Connect_Retry: 60
            Master_Log_File: mysql-bin.000016
        Read_Master_Log_Pos: 173
             Relay_Log_File: mysqld-relay-bin.000008
              Relay_Log_Pos: 98
      Relay_Master_Log_File: mysql-bin.000016
           Slave_IO_Running: No
          Slave_SQL_Running: Yes
            Replicate_Do_DB: 
        Replicate_Ignore_DB: 
         Replicate_Do_Table: 
     Replicate_Ignore_Table: br>                 Last_Errno: 0
                 Last_Error: 
               Skip_Counter: 0
        Exec_Master_Log_Pos: 173
            Relay_Log_Space: 98
            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
1 row in set (0.00 sec)
[root@slave mysql]# tail /var/log/mysqld.log
081223 15:51:50  InnoDB: Started; log sequence number 0 43655
081223 15:51:51 [Warning] Neither --relay-log nor --relay-log-index were used; so replication may break when 
this MySQL server acts as a slave and has his hostname changed!! Please use '--relay-
log=/var/run/mysqld/mysqld-relay-bin' to avoid this problem.
081223 15:51:51 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.0.45-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3307  Source distribution
081223 15:51:51 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000016' at 
position 173, relay log '/var/run/mysqld/mysqld-relay-bin.000007' position: 98
081223 15:51:51 [Note] Slave I/O thread: connected to master 
[email='slave@192.168.3.21:3307']'slave@192.168.3.21:3307'[/email]
,  replication started 
in log 'mysql-bin.000016' at position 173
081223 15:51:51 [ERROR] Error reading packet from server: Could not find first log file name in binary log 
index file ( server_errno=1236)
081223 15:51:51 [ERROR] Got fatal error 1236: 'Could not find first log file name in binary log index file' 
from master when reading data from binary log
081223 15:51:51 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000016', position 173
081223 15:51:58 [Note] Error reading relay log event: slave SQL thread was killed
解决步骤:
重启master库:service mysqld restart
mysql> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 |       98 |              |                  | 
+------------------+----------+--------------+------------------+
mysql> slave stop;
mysql> change master to Master_Log_File='mysql-bin.000001',Master_Log_Pos=98;
mysql> slave start;
mysql> show slave status\G
*************************** 1. row ***************************
             Slave_IO_State: Waiting for master to send event
                Master_Host: 192.168.3.21
                Master_User: slave
                Master_Port: 3307
              Connect_Retry: 60
            Master_Log_File: mysql-bin.000001
        Read_Master_Log_Pos: 98
             Relay_Log_File: mysqld-relay-bin.000002
              Relay_Log_Pos: 235
      Relay_Master_Log_File: mysql-bin.000001
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes
            Replicate_Do_DB: 
    Replicate_Wild_Do_Table: 
Replicate_Wild_Ignore_Table: 
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: 98
            Relay_Log_Space: 235
            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
1 row in set (0.00 sec)

转载于:https://blog.51cto.com/ppp1013/447810

mysql Slave_IO_Running:NO(解决方法)相关推荐

  1. java.lang.ClassNotFoundException: com.mysql.jdbc.Driver 解决方法 java.lang.ClassNotFoundException: com.

    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver 解决方法 java.lang.ClassNotFoundException: com.m ...

  2. MySQL锁表解决方法

    MySQL锁表解决方法 参考文章: (1)MySQL锁表解决方法 (2)https://www.cnblogs.com/xiaoL/p/11099291.html 备忘一下.

  3. Idea运行web项目时,提示java.lang.ClassNotFoundException: com.mysql.jdbc.Driver解决方法

    Idea运行web项目时,提示java.lang.ClassNotFoundException: com.mysql.jdbc.Driver解决方法 参考文章: (1)Idea运行web项目时,提示j ...

  4. jsp mysql中文乱码,jsp中文乱码 jsp mysql 乱码的解决方法

    jsp中文乱码 jsp mysql 乱码的解决方法 jsp中文乱码 jsp mysql 乱码要servlet里面支持中文的方法: 在dopost或者doget的第一句加上: request.setCh ...

  5. mysql开发问题解决_开发过程中mysql常见问题的解决方法

    本篇文章给大家带来的内容是关于开发过程中mysql常见问题的解决方法,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. 记录开发过程中遇到mysql相关的问题以及解决方法,长期更新. 远 ...

  6. ubuntu 破解mysql密码_Ubuntu下忘记MySQL root密码解决方法

    Linux下忘记MySQL root密码解决方法 忘了mysql密码,从网上找到的解决方案记录在这里. 编辑mysql的配置文件/etc/mysql/my.cnf,在[mysqld]段下加入一行&qu ...

  7. sqlyog for MySQL远程连接的时候报错mysql 1130的解决方法

    通过Navicat for MySQL远程连接的时候报错mysql 1130的解决方法 今天在用远程连接Mysql服务器的数据库,不管怎么弄都是连接不到. 错误代码是1130,ERROR 1130: ...

  8. MySQL兼容服务器_服务器不支持 MySql 数据库的解决方法

    php.ini文件没有参数没有配置正确 解决方法: (1) 打开php.ini文件,找到: extension_dir = "./" 将其改为: extension_dir = & ...

  9. 无法打开数据库‘mysql_MySQL数据库之MYSQL无法启动解决方法

    本文主要向大家介绍了MySQL数据库之MYSQL无法启动解决方法 ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助. 在my.ini(linux下/etc/my.cnf)加上skip ...

  10. 【转】QT中使用MYSQL中文乱码解决方法

    [转]QT中使用MYSQL中文乱码解决方法 Linux下乱码解决办法: 1.在QT程序的main.cpp的main函数中添加红色字那三句: int main(int argc, char *argv[ ...

最新文章

  1. Reddit年度盘点:那些2019年最佳机器学习项目
  2. 计算机办公应用适合什么工作,有什么软件堪称办公神器,让你每天的工作轻松不累?...
  3. 网页设计布局选择:固定,流行和弹性布局 (2010-12-14 13:07:35)
  4. mysql主从同步slave_MySQL主从复制(Master-Slave)实践
  5. 《C++ Primer》14.3.2节练习(部分)
  6. Oracle中listener does not currently know of SID given in connect descriptor
  7. linux vbox安装mac os,超简单的linux下virtualbox4.3.26安装配置黑苹果 OSX 10.9的办法
  8. 棒!使用.NET Core构建3D游戏引擎
  9. 基本完成的重力空间的对任意形状的碰撞子系统
  10. 修改Ubuntu系统的用户名和主机名、创建和删除用户
  11. numpy 常用产生随机数方法
  12. 盘口功夫——研判股价启动前的四种征兆----
  13. idea里面的注释模板
  14. qt 二维数组初始化_C++数组初始化方法
  15. Kotlinx.serialization VS Gson
  16. PAT A1038 Recover the Smallest Number ——醉里挑灯看剑
  17. 外国优秀网页html,200个优秀的国外设计网站推荐
  18. 基于WinUSB的异步方式bulk传输的稳定性问题
  19. 使用Python异序词检测示例_清点法_排序法_蛮力法_计数法
  20. (翻译)导航栏按钮的5类常见设计错误

热门文章

  1. java break(),Java BreakIterator last()用法及代码示例
  2. vue中if和for指令不能同时使用
  3. python中的super用法详解_Python中super的用法实例
  4. html搜题软件,大学搜题app哪个好_大学好的搜题软件_大学搜题免费
  5. spring boot和spring cloud的区别_微服务实战系列(三)-cloud、boot及maven关系
  6. ppt中流程图旁边怎么添加_辅食中的黑芝麻酱怎么添加呢?
  7. 20210503:力扣第239周周赛题解
  8. 化工计算机软件基础考试题,化工原理模拟试题(一)及答案.doc
  9. java中int边界值_数组中重复的数字2019.12.06
  10. 52单片机定时器2使用(C语言程序)