win下maridb 10.1.8下主从复制配置

主库配置

server_id=1
read-only=0
replicate-do-db=mydata
log-bin=mysql-bin

主库权限设置

GRANT replication slave ON *.* TO'backup'@'%' identified BY 'password';

flush PRIVILEGES;

GRANT EXECUTE, SELECT, SHOW VIEW, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, INDEX, INSERT, REFERENCES, TRIGGER, UPDATE, LOCK TABLES ON `mydata`.* TO 'backup'@'%' WITH GRANT OPTION
FLUSH PRIVILEGES;

show master status

从库配置:

server_id=2
read-only=1
replicate-do-db=mydata
log-bin=mysql-bin

change master to MASTER_HOST='172.20.42.224', MASTER_USER='backup',MASTER_PASSWORD='password', MASTER_LOG_FILE='mysql-bin.000085',MASTER_LOG_POS=839, master_connect_retry=60,MASTER_PORT=3307

注意点:mysql-bin.000085 和 839 这2个参数来自主库show master status的查询。

stop SLAVE

START slave

SHOW SLAVE status

这三个状态 slave_IO_state、slave_IO_running、slave_SQL_running 是yes,配置成功。

posted on 2019-09-28 22:23  alantop  阅读(220)  评论(0编辑  收藏  举报