### my.cnf
```
server-id = 200
```
###2.從數據庫執行同步語句
```
change master to
master_host='172.17.0.3',
master_user='root',
master_password='39c1c2217ecd8f866a5501ed35fbebe4',
master_log_file='mariadb-bin.000002',
master_log_pos=3255;
```
### 3.啟動Slave同步進程
```
start slave;
```
###4.主從同步檢查
```
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
兩個都是Yes說明正常
MariaDB [(none)]> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.17.0.3
Master_User: root
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mariadb-bin.000001
Read_Master_Log_Pos: 527
Relay_Log_File: mysqld-relay-bin.000002
Relay_Log_Pos: 557
Relay_Master_Log_File: mariadb-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 527
Relay_Log_Space: 867
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 100
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: No
Gtid_IO_Pos:
Replicate_Do_Domain_Ids:
Replicate_Ignore_Domain_Ids:
Parallel_Mode: conservative
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Slave_DDL_Groups: 0
Slave_Non_Transactional_Groups: 0
Slave_Transactional_Groups: 0
1 row in set (0.000 sec)
```
- 關系型數據庫
- 簡介
- mysql
- 簡介
- 命令行
- 服務端
- 客戶端
- 基礎
- 連接數據庫
- 數據庫操作
- 數據庫增刪
- 存儲引擎
- 簡介
- innodb
- 存儲格式
- 存儲順序
- 并發處理
- Myisam
- 存儲格式
- 存儲順序
- 并發處理
- memory
- 數據表操作
- 創建數據表
- 主鍵約束
- 單字段主鍵
- 多字段聯合主鍵
- 外鍵約束
- 非空約束
- 唯一約束
- 默認約束
- 自動增長
- 查看數據表結構
- describe
- show
- 修改數據表
- 數據類型和運算符
- 數據類型
- 數據操作
- join
- inner join
- left outer join
- right outer join
- full outer join
- cross join
- disctinct
- having
- 數據備份
- 優化
- 慢查詢
- 開啟慢查詢
- 查看日志
- 精確記錄查詢時間
- 索引
- 簡介
- 類型
- 普通索引
- 唯一索引
- 主鍵索引
- 全文索引
- 原則
- 列獨立
- like
- or
- 復合索引
- 智能優化
- group by
- 鎖
- 分區
- 分表
- 視圖
- 存儲過程
- 存儲函數
- 觸發器
- 事務
- 讀寫分離
- 主從復制
- 主數據庫
- 從數據庫
- 主數據庫鎖定
- 非關系型數據庫
- mongodb
- 簡介
- mysql與mongodb性能比較
- 安裝
- Windows
- 基礎
- 基本概念
- 數據類型
- 常用操作
- 數據庫
- 集合
- 文檔
- 幫助命令
- 用戶管理
- 概述
- 超級管理員
- redis
- 安裝
- 安裝
- redis.conf
- 運行
- 主從
- 主
- 從
- 測試
- 中間件
- mycat
- 簡介
- 安裝
- 配置文件
- server.xml
- 讀寫分離
- server.xml
- schema.xml
- 高可用