mysql 复制搭建

11月 29, 2021 |

vim my.cnf

log_bin=mysql-bin #bin log名词
server_id=10 #server-id
relay_log=relay-bin #设置中继文件的文件名
log_slave_updates = 1 #slave也将relay-log写入自己的bin-log
read_only=1 ;#slave端设置为自读

master

create user 'repl'@'%' identified by '123456'
grant replication slave, replication client on *.* to repl@'%' ;

flush logs; #切换新的bin log文件

slave

change master to master_host='192.168.228.131',
master_user='repl',
master_password='Root@123',
master_log_file='mysql-bin.000003',
master_log_pos=154;

start slave;
show slave status;
show master status;
stop slave;

slave reset
change master to master_host='';
reset slave;

Posted in: database

Comments are closed.