mysql主从同步

时间:2014-07-16 21:32:42   收藏:0   阅读:216

1.修改配置文件

主服务器master:

[mysqld]
log-bin=mysql-bin

server-id=222

 

修改从服务器slave:

[mysqld]
log-bin=mysql-bin 
server-id=226

重启两台服务器的mysql

 

2.在主服务器上建立帐户并授权slave:

GRANT REPLICATION SLAVE ON *.* to ‘son‘@‘%‘ identified by ‘a123456‘;

show master status;

记住, File,Position

 

3.配置从服务器Slave:

change master to master_host=‘192.168.0.113‘,master_user=‘son‘,master_password=‘a123456‘,master_log_file=‘mysql-bin.,000009‘,master_log_pos=240;

 

4.查看结果开启同步

Mysql>start slave;

mysql> show slave status\G

 

 

 

 

mysql主从同步,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!