标签:
两台服务器
主:192.168.0.101
从:192.168.0.108
GRANT REPLICATION SLAVE,RELOAD,SUPER ON *.* TO ‘backup‘@‘192.168.0.108‘ IDENTIFIED BY ‘abcd1234‘;
vi /etc/my.cnf -------------- server_id=101 log-bin=mysql-bin
service mysqld restart
mysql -uroot -ppassword
查看master的文件和position
show master status;
从上图可以看到,目前master的bin-log文件存在mysql-bin.00003中,position是670
vi /etc/my.cnf -------------- server_id=108 log-bin=mysql
service mysqd restart
mysql -uroot -ppassword
change master to master_host=‘192.168.0.101‘,master_user=‘backup‘,master_password=‘abcd1234‘,master_log_file=‘mysql-bin.000003‘,master_log_pos=670;
start slave
标签:
原文地址:http://www.cnblogs.com/cnsuifeng/p/5811291.html