一、环境:
主机IP | 操作系统版本 | MySQL版本 | 安装方法 | 角色 |
10.0.0.13(master) | centos7.3 | 5.6.17 | 源码编译安装 | 主库 |
10.0.0.14(slave) | centos7.3 | 5.6.17 | 源码编译安装 | 从库 |
二、数据库安装步骤:
查看以下链接:https://mp.csdn.net/postedit/82810888
三、配置主从同步:
1.配置主服务器master(10.0.0.14):
一、vim /etc/my.cnf 加入以下两行,后重启mysqld服务
server_id = 1 log_bin=mysql-bin
二、创建一个用于复制的账户
mysql> create user admin@'%' identified by 'password'; mysql> grant all privileges on *.* to admin@'%'; mysql> flush privileges;
三、主服务器备份数据,并传输到从
mysql> flush tables with read lock; mysql> show master status; +------------------+----------+--------------+------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +------------------+----------+--------------+------------------+-------------------+ | mysql-bin.000001 | 120 | | | | +------------------+----------+--------------+------------------+-------------------+ row in set (0.00 sec)
[root