数据库版本:
https://blog.csdn.net/wangxiaotongfan/article/details/81870258
https://www.cnblogs.com/gl-developer/p/6170423.html
主服务器:
mysql>CREATE USER 'replicator'@'%' IDENTIFIED WITH 'mysql_native_password' BY 'MyNewPass@123';
mysql>GRANT REPLICATION SLAVE ON *.* TO 'replicator'@'%';
mysql>show master statusG;
[mysqld] log-bin=mysql-bin #开启二进制日志 server-id=1 #设置server-id
从服务器:
[mysqld]
[mysqld]
server-id=2 #设置server-id,必须唯一
relay-log=slave-relay-bin
relay-log-index=slave-relay-bin.index
read_only=1
mysql>reset salve;
mysql>
CHANGE MASTER TO
MASTER_HOST='192..168.0.1',
MASTER_USER='replicator',
MASTER_PASSWORD='MyNewPass@123',
MASTER_LOG_FILE='master-bin.000003',
MASTER_LOG_POS=1128;
mysql>start slave;
mysql>show slave statusG;