标签:
从库:192.168.1.20
开启db_test单库复制
常见问题
参考文档
grant replication slave on *.* to ‘repl‘@‘192.168.1.19‘ identified by ‘mysql‘;
flush privileges;
cd /opt/svr/mariadb5/etc
vi my.cnf
打开binlog某些配置项,即开启主库的写binlog配置,调整过的参数如下:
log-bin=/opt/dbdat/mariadb5_data3306/log/mysql-bin #binlog存放路径
log-bin-index=/opt/dbdat/mariadb5_data3306/log/mysql-bin.index
binlog-do-db = db_test #只开启db_test库的复制,其他库不复制
binlog-format=row #行模式复制
/opt/dbdat/mariadb5_data3306/log/mysql-bin
mysql-bin.000001 mysql-bin.index
show master status;
连接主库
通过下面sql连接主库,注意其中的用户密码,以及binlog文件名、读binlog的位置(可通过上面show master status;sql查询master最新位置)
执行sql:change master to master_host=‘192.168.1.19‘, master_user=‘repl‘, master_password=‘mysql‘, master_log_file=‘mysql-bin.000001‘, master_log_pos=0;
开启slave复制
执行sql: slave start
执行sql:show slave status \G;
执行sql:show variables like "%slave%";
标签:
原文地址:http://www.cnblogs.com/lsl8966/p/4179500.html