mysql -u root -p'123456' #进入MySQL
mysql>change master to master_host='192.168.1.100',master_user='mysync',master_password='123456',master_log_file='mysql-bin.000008',master_log_pos=520;
mysql> show databases;
+----------------------+
| Database |
+----------------------+
| information_schema |
| test_db |
| mysql |
+----------------------+
4 rows in set (0.00 sec)
从服务器Mysql查询:
mysql> show databases;
+----------------------+
| Database |
+----------------------+
| information_schema |
| test_db |
| mysql |
+----------------------+
4 rows in set (0.00 sec)
mysql> use test_db
Database changed
mysql> select * from test_db; //查看主服务器上新增的具体数据
+------+------+
| id | name |
+------+------+
| 1 | bobu |
+------+------+
1 row in set (0.00 sec)