[tyms]> show binlog events in '/mysql/data/mysqldata/mydata/mysql-bin.000014' from 3051261;
[(none)]> select version();
+------------+
| version() |
+------------+
| 5.6.28-log |
+------------+
1 row in set (0.00 sec)
可以看到:Slave_IO_Running | Slave_SQL_Running两个值都是YES,说明配置成功了。可以在主库里执行DML或者DDL验证下。
如果同步不成功:
1:停掉从库
mysql> slave stop
2:主库上找到日志和位置
mysql> show master status;
(root@localhost) [(none)]> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000014 | 594 | | | |
+------------------+----------+--------------+------------------+-------------------+
3:手动同步
mysql> change master to
> master_host='master_ip',
> master_user='gechong',
> master_password='gechong',
> master_port=3306,
> master_log_file='mysql-bin.000014',
> master_log_pos=594;
1 row in set (0.00 sec)
4:启动从库
mysql> slave start;
1 row in set (0.00 sec)
如果有异常需要可执行跳过:
>slave stop;
>SET GLOBAL sql_slave_skip_counter = 1;
>slave start;