由于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解决。

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号