第一步:添加主从同步账户
--在主机192.168.11.65添加同步账户192.168.11.66(账户root,密码guoqing)
mysql> grant replication slave on *.* to 'root'@'192.168.11.66' identified by 'guoqing';
第二步:查看主数据库状态
mysql> flush pricileges;
mysql> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000003 | 107 | | |
+------------------+----------+--------------+------------------+
1 row in set
第三步:重启主数据库
... ...
第四步:在192.168.11.66配置同步信息
mysql> change master to master_host='192.168.11.65',master_port=3306,master_user='root',master_password='guoqing',master_log_file='mysql-bin.000003',master_log_pos=107;
mysql> start slave;
mysql> show slave status;
出现下图就ok