Home > Database > Mysql Tutorial > MySQL主从不同步解决

MySQL主从不同步解决

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:24:20
Original
1239 people have browsed it

由于binlog日志带多删除了几个后发现MySQL主从不同步

1、由于binlog日志带多删除了几个后发现MySQL主从不同步
 
mysql> show slave status\G;
 
              Slave_IO_Running: No
            Slave_SQL_Running: Yes
 
查看报错日志为
 
 [ERROR] Slave I/O: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file',
 
解决方式
 
从服务器配置:
 

主服务器查看
 
mysql> show master status;
 
+------------------+----------+--------------+------------------+
 
| File            | Position | Binlog_Do_DB | Binlog_Ignore_DB |
 
+------------------+----------+--------------+------------------+
 
| mysql-bin.000005 |      106 |              |                  |
 
+------------------+----------+--------------+------------------+
 
1 row in set (0.00 sec)
 
从服务器设置
 
mysql> change master to master_host='192.168.0.10',master_user='replication',master_password='replication',master_log_file='mysql-bin.000003',master_log_pos=106;
 
Query OK, 0 rows affected (0.03 sec)
 
 
 
mysql>stop slave;
 
mysql>start slave;
 
 
 
主服务器配置
 
从服务器上查看
 
mysql> show master status;
 
+------------------+----------+--------------+------------------+
 
| File            | Position | Binlog_Do_DB | Binlog_Ignore_DB |
 
+------------------+----------+--------------+------------------+
 
| mysql-bin.000005 |      106 |              |                  |
 
+------------------+----------+--------------+------------------+
 
1 row in set (0.00 sec)
 
主服务器配置
 
mysql> change master to master_host='192.168.0.11',master_user='replication',master_password='replication',master_log_file='mysql-bin.000005',master_log_pos=106;
 
Query OK, 0 rows affected (0.03 sec)
 
mysql>stop slave;
 
mysql>start slave;
 
在查看slave状态ok解决。

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template