`

mysql 主从配置

阅读更多

MySQL主从配置

Master操作:

1.接入mysql并创建主从复制的用户

create user m2ssync identified by '123456!@#';

2.给新建的用户赋权

GRANT REPLICATION SLAVE ON *.* TO

'm2ssync'@'%' IDENTIFIED BY '123456!@#';

3.指定服务ID,开启binlog日志记录,在my.cnf

中加入

 

server-id=137

log-bin=dbstore_binlog

binlog-do-db=db_store #数据库

 

 

4.通过SHOW MASTER STATUS;查看Master db状

态.

 

Slave操作:

1.指定服务器ID,指定同步的binlog存储位置,在

my.cnf中加入

 

server-id=101

relay-log=slave-relay-bin

relay-log-index=slave-relay-bin.index

read_only=1

replicate_do_db=db_store

 

 

2.接入slave的mysql服务,

并配置

 

change master to

master_host='192.168.0.86', #MASTER HOST

master_port=3306,master_user='m2ssync',master_password='123456!@#',master_log_file='db_stoere_binlog.000001',master_log_pos=0;

 

 

3.start slave;

4. show slave status\G ;查看slave服务器状态

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics