一.mysql主从复制
1.创建两台CentOS7的虚拟机:主机ip:192.168.204.130 从机ip:192.168.204.135
2.找到两台机器的配置文件my.cnf并修改配置,如图所示,第一个是主机配置id取ip后三位,第二个是从机配置.
3.在主机上创建用户并授权slave:
create user '用户名'@'%' identified with mysql_native_password by '用户密码';
grant replication slave on *.* to ‘用户名'@'%';
flush privileges;
操作完成之后查看master状态:show master status\G;
(注意:要记录图中的file以及position值,后面需要用到)
4.在从机中写入二进制文件名与位置
change master to master_host =