Mysql主从服务器配置
主服务器:122.11.32.57
从服务器:122.11.32.58
1.创建复制账号。
主服务器:
Grant replication slave on *.* to repl@'122.11.32.58' identified by 'p4ssword'
flush privileges;
2.配置主库和副库
主库,修改/etc/my.cnf
server-id=3257
log-bin=mysql-bin
从库,修改 /etc/my.cnf
server-id=3258
log-bin=mysql-bin
重启mysql
3.备库启动复制
change master to master_host='122.11.32.57',master_user='repl',master_password='p4ssword',master_log_file='mysql-bin.000001',master_log_pos=0
start slave;
在主服务器上看,
show master status;
show processlist;
在从服务器上看,
show slave status;
show processlist;
主服务器:122.11.32.57
从服务器:122.11.32.58
1.创建复制账号。
主服务器:
Grant replication slave on *.* to repl@'122.11.32.58' identified by 'p4ssword'
flush privileges;
2.配置主库和副库
主库,修改/etc/my.cnf
server-id=3257
log-bin=mysql-bin
从库,修改 /etc/my.cnf
server-id=3258
log-bin=mysql-bin
重启mysql
3.备库启动复制
change master to master_host='122.11.32.57',master_user='repl',master_password='p4ssword',master_log_file='mysql-bin.000001',master_log_pos=0
start slave;
在主服务器上看,
show master status;
show processlist;
在从服务器上看,
show slave status;
show processlist;