Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0.13 sec)
5 测试:
主:
mysql> use students;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> insert into users values (3,"c");
Query OK, 1 row affected (0.01 sec)
mysql> select * from users;
+----+------+
| id | name |
+----+------+
| 1 | a |
| 2 | b |
| 3 | c |
+----+------+
3 rows in set (0.00 sec)
看从库:
mysql> use students;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from users;
+----+------+
| id | name |
+----+------+
| 1 | a |
| 2 | b |
| 3 | c |
+----+------+
3 rows in set (0.00 sec)
到此为止主从就做好了,现开始做主主了:
1 在原从服务器上授权:
mysql> grant replication slave on *.* to 'hm100'@'192.168.1.28' identified by '123456';
Query OK, 0 rows affected (0.03 sec)
1.1 编辑配置文件
binlog-do-db = students 加要同步的数据库
1.2 重启
# /etc/init.d/mysql restart
Shutting down MySQL... SUCCESS!
Starting MySQL..... SUCCESS!
mysql -uroot -p
mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+