(2)主机设置
log-bin=master-bin
binlog_format=mixed
server-id=1
[iyunv@nan86 tmp]# /etc/init.d/mysqld restart
ERROR! MySQL server PID file could not be found!
Starting MySQL.. SUCCESS!
(3)从机设置
log-bin=slave-bin
binlog_format=mixed
server-id=10
[iyunv@nan85 ~]# /etc/init.d/mysqld restart
ERROR! MySQL server PID file could not be found!
Starting MySQL.. SUCCESS!
(4)在master上面创建一个复制用户并授予权限
mysql> grant replication slave on *.* to 'emp'@'10.10.54.85' identified by '123';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
(5)查看master上的二进制日志和position位置
mysql> show master status;
+-------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-------------------+----------+--------------+------------------+
| master-bin.000006 | 330 | | |
+-------------------+----------+--------------+------------------+
1 row in set (0.00 sec)