第十章实验要求1
实现mysql主从复制
1、打开三台mysql服务器,配置相应ip,实现时间同步
主服务器:
mount /dev/cdrom /benet
yum -y install ntp
vim /etc/ntp.conf
systemctl restart ntpd
从服务器:
mount /dev/cdrom /mnt
yum -y install ntpdate
ntpdate 192.168.12.1
2、配置主服务器配置文件,添加授权用户,查看日志信息。
主服务器:
vim /etc/my.cnf
systemctl restart mysqld
grant replication slave on . to ‘root’@‘192.168.100.%’ identified by ‘abc123’;
3、配置两台从服务器配置文件,在从服务器中连接主服务器并启动主从复制,查看连接状态。
从服务器:
vim /etc/my.cnf
systemctl restart mysqld
change master to master_host=‘192.168.100.114’,master_user=‘root’,master_password=’’,master_log_file=‘master-bin.000001’,master_log_pos=199;
4、在主服务器中创建班级名数据库和本人名表,验证两台从服务器中可以成功同步复制到相应信息。