MySQL 复制简要描述及示例(3)

#下面在主库上执行一些操作以检查从库的同步情况
master@localhost[(none)]> show variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id    | 3406  |
+---------------+-------+
1 row in set (0.00 sec)

#主库上Binlog Dump线程用于发送binlog日志文件到从库,如下查询
master@localhost[(none)]> show processlist\G
*************************** 1. row ***************************
    Id: 12
  User: repl
  Host: 192.168.1.177:57440
    db: NULL
Command: Binlog Dump
  Time: 511342
  State: Master has sent all binlog to slave; waiting for binlog to be updated
  Info: NULL
 
#主库创建数据库及表
master@localhost[(none)]> create database tempdb;
Query OK, 1 row affected (0.01 sec)

master@localhost[(none)]> use tempdb
Database changed
master@localhost[tempdb]> create table tb_engines as select * from information_schema.engines;
Query OK, 9 rows affected (0.02 sec)
Records: 9  Duplicates: 0  Warnings: 0

#下面是在从库上检查的结果
slave@localhost[(none)]> select count(*) from tempdb.tb_engines;
+----------+
| count(*) |
+----------+
|        9 |
+----------+

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/33edb8b6e25d83dc7f0c06a453541a52.html