mysql数据库主从表数据添加,求教,mysql主从复制,主表插入数据后,从表未同步,且状态异常...

问题大概是这样的:mysql主从复制,配置好之后,查看从表状态正常:

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

然后在主表插入数据,从表未同步,状态异常:

Slave_IO_Running: Yes

Slave_SQL_Running: No

具体情况如下:

主库在windows上,从库在虚拟机上;

主库配置

my.ini

[mysqld]

# 主从配置

# 日志文件名以“mysql-bin”作为前缀

log-bin=mysql-bin

server-id=1

binlog-do-db=blog

从库配置

my.cfg

[mysqld]

server-id = 2

port = 3306

log-bin=mysql-bin

binlog_format=mixed

windows执行

show master status;

显示如下

+------------------+----------+--------------+------------------+-------------------+

| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |

+------------------+----------+--------------+------------------+-------------------+

| mysql-bin.000035 |     1253 | blog         |                  |                   |

+------------------+----------+--------------+------------------+-------------------+

虚拟机执行

stop slave;

CHANGE MASTER TO MASTER_HOST='192.168.1.110',

MASTER_USER='root',

MASTER_PASSWORD='root',

MASTER_LOG_FILE='mysql-bin.000035',

MASTER_LOG_POS=1253;

start slave;

show slave status \G;

显示如下

4943c0c7c8324fa022c519f6bfb53779.png

红色部分这里看着是没问题的

然后在主表执行一条insert语句之后,再执行

show slave status \G;

命令后,

主表数据插入成功,从表未同步,且状态异常:

Slave_IO_Running: Yes

Slave_SQL_Running: No

a5bb2a68e5ae5d522fdb228efe3bc8ba.png

last error 信息

Last_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.

使用

mysqlbinlog relay-log.info

查看日志看到如下错误

ERROR: File is not a binary log file.

请问可能是哪里出了问题?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值