日期:2014-05-16 浏览次数:20948 次
1、/etc/my.cnf 主数据库配置
#一般已存在
server-id = 1
#需要进行复制的数据库
binlog-do-db = search
#不需要进行复制的数据库
replicate-ignore-db = mysql
replicate-ignore-db = test
replicate-ignore-db = information_schema
#生成的同步数据所需要的文件,序号从: mysql-bin.000001开始
log-bin=mysql-bin
2、重启mysql,登陆Mysql,设置从数据库所需要的权限:可以从任何机器登陆,账号/密码:slave1/ passw0rd
grant replication slave,reload,super on *.* to 'slave1'@'%' identified by 'passw0rd';
3、查看状态
mysql> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000005 | 7657 | search | |
+------------------+----------+--------------+------------------+
1 row in set (0.01 sec)