[root@Master-Mysql ~]# /usr/local/mysql/bin/mysql -uroot -p'' < /tmp/192.168.199.178.sql #如果主、从一致非必须
mysql> update mysql.user set password=PASSWORD('admin') where user='root';
[root@Master-Mysql ~]# cat |/usr/local/mysql/bin/mysql -uroot -p'admin' <
> CHANGE MASTER TO
> MASTER_HOST='192.168.199.178',
> MASTER_PORT=3306,
> MASTER_USER='byrd',
> MASTER_PASSWORD='admin',
> MASTER_LOG_FILE='mysql-bin.000004',
> MASTER_LOG_POS=120;
> EOF
mysql> start slave;
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.199.178
Master_User: byrd
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000004
Read_Master_Log_Pos: 938
Relay_Log_File: mysqld-relay-bin.000002
Relay_Log_Pos: 1101
Relay_Master_Log_File: mysql-bin.000004
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Last_Errno: 0
Skip_Counter: 0
Exec_Master_Log_Pos: 938
Relay_Log_Space: 1275
Until_Condition: None
Until_Log_Pos: 0
Master_SSL_Allowed: No
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_SQL_Errno: 0
Master_Server_Id: 2
Master_UUID: 34d672c3-d292-11e3-9ff5-00155dc7834c
Master_Info_File: /usr/local/mysql/data/master.info
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
Master_Retry_Count: 86400