一、主
==================================================================
[mysqld]
skip-name-resolve
server-id=1
log-bin=mysql-bin
log-bin-index=master-bin.index
expire_logs_days =10
default-storage-engine=INNODB
character-set-client-handshake= FALSE
character-set-server= utf8mb4
collation-server =utf8mb4_unicode_ci
init_connect='SETNAMES utf8mb4'
[client]
default-character-set= utf8mb4
==================================================================
create userrepl;
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%' IDENTIFIED BY 'mysql';
SHOW MASTER STATUS;
==================================================================
二、从
==================================================================
[mysqld]
skip-name-resolve
server-id=2
relay-log-index=slave-relay-bin.index
relay-log=slave-relay-bin
log-bin=mysql-bin
expire_logs_days =10
default-storage-engine=INNODB
character-set-client-handshake= FALSE
character-set-server= utf8mb4
collation-server =utf8mb4_unicode_ci
init_connect='SETNAMES utf8mb4'
[client]
default-character-set= utf8mb4
==================================================================
stop slave;
reset slave;
changemaster to master_host='192.168.11.13',
master_port=3306,
master_user='repl',
master_password='mysql',
master_log_file='mysql-bin.000001',
master_log_pos=4533;
start slave;
show slave status
==================================================================