一 . 环境准备
先上拓扑图
两个虚拟机 129和130.CentOS 6.3 安装mysql 版本5.1 .yum 确保安装配置一样.
1 yum -y install mysql mysql-devel mysql-server
service mysqld start
二 环境.
实验环境 service iptables stop || setenforce 0
三 主从配置
vi /etc/my.cnf
1 主服务器2 log-bin3 server-id=129
4 从服务器5 log-bin6 server-id=130
主服务器上
1 grant replication slave on *.* to 'testsync'@'*' identified by '123456'
创建账号给从服务器用.
** use mysql; select * from user='testsync' 能看到账号建立.这一步一般不会有问题.
1 mysql>show master status\G2 *************************** 1. row ***************************
3 File: mysqld-bin.000001
4 Position: 106
5 Binlog_Do_DB:6 Binlog_Ignore