主服務器查看
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解決。