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. 2019年人工智能行业现状与发展趋势报告
  2. Xamarin XAML语言教程基本页面ContentPage占用面积
  3. Django form表单
  4. Ubuntu nginx 配置实例
  5. Swift之深入解析基于闭包的类型擦除
  6. 化敌为友,微软出手优化 Chrome!
  7. 王者峡谷一呼百应,弹幕“666”,背后都离不开长连接,如何实现千万级高性能的长连接网关?...
  8. 深入理解DRM(二)——了解Widevine与OEMCrypto
  9. Litestar4D道路照明设计
  10. Docker制作深度学习镜像常用操作
  11. 软件测试工程师有哪些要求
  12. 防抖和节流理解,以及lodash使用
  13. 区块链将颠覆游戏业,游戏内商品未来也可带出游戏、自由交易
  14. unity 下载文件到存放本地
  15. c #点击按钮下载excel文件
  16. 1.4、路由初认识及构建园区网
  17. linux学习第十周总结
  18. Apache DolphinScheduler 在叽里呱啦的实战经验
  19. AVI 文件格式解析
  20. 遇到oracle错误1445,sql附加数据库失败

热门文章

  1. python如何定义类_Python class定义类,Python类的定义(入门必读)
  2. 共享端口445能改吗_模玩控:高达模型改圣斗士星矢五小强,大家能认出它们都是机体吗?...
  3. 简单入门Buffer
  4. 自定义模块的查找方式
  5. 利用matlab的帮助功能分别查询inv,MATLAB实验报告第一章..doc
  6. ccd视觉定位教程_CCD与CMOS哪个更能推动工业相机市场的发展
  7. Python简单GUI(随机点名)
  8. 20200814:力扣201周周赛题解记录上
  9. apache31分是重症吗,APACHEⅢ重症评估系统
  10. java duration 时间差_java8 计算时间差的方法示例