--从库上设置主库的相关信息(host,port等等)
slave@localhost[tempdb]> change master to
-> MASTER_HOST='192.168.1.177',
-> MASTER_USER='repl',
-> MASTER_PASSWORD='xxx',
-> MASTER_PORT=3406,
-> MASTER_LOG_FILE='inst3406bin.000001',
-> MASTER_LOG_POS=3293117;
Query OK, 0 rows affected, 2 warnings (0.01 sec)
--启动从库
slave@localhost[tempdb]> start slave;
Query OK, 0 rows affected (0.01 sec)
-- Author : Leshami
-- Blog :
--校验结果
slave@localhost[tempdb]> show slave status \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.1.177
Master_User: repl
Master_Port: 3406
Connect_Retry: 60
Master_Log_File: inst3406bin.000001
Read_Master_Log_Pos: 3293117
Relay_Log_File: relay-bin.000002
Relay_Log_Pos: 285
Relay_Master_Log_File: inst3406bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: test,sakila
--需要注意的是,本文的mysqldump期间,--single-transaction 仅仅对innodb引擎有效
--如果仅使用--master-data,则会开启--lock-all-tables
The --master-data and --single-transaction options can be used simultaneously, which provides a convenient way to
make an online backup suitable for use prior to point-in-time recovery if tables are stored using the InnoDB
storage engine.