版权声明:欢迎评论、补充;24小时内回复;及时更新;欢迎转载。 https://blog.csdn.net/li905663280/article/details/78248007
图
master
master 新增用户
mysql>grant replication slave on *.* to 'repl'@'%' identified by 'repl';
mysql>flush privileges;
master my.cnf
server-id=50
log-bin=/var/lib/mysql/mysql-bin
binlog-do-db=demo1
log-slave-updates=1
重启
mysqld restart
mysql>flush tables with read lock;
mysql> show master status; (此处记住File名称和Position值,后面slave服务器配置时需要用到)
mysqldump test > test.sql
mysql>unlock tables;
slave
slave my.ini
server-id=109
启动slave
mysqld restart;
mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)
mysql> change master to
-> master_host='192.168.0.107',
-> master_user='repl',
-> master_password='repl',
-> master_log_file='mysql-bin.000001',
-> master_log_pos=713;
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> show slave status\G;
ref url
http://www.cnblogs.com/rwxwsblog/p/4542417.html
http://www.cnblogs.com/gomysql/p/5852607.html