mysql 互为主从
一:安装部署mysql主从复制环境:
-
使用yum安装部署mysql两台
yum -y install mariadb-server systemctl start mariadb vim /etc/my.cnf server-id=1 log-bin=qi relay-log=wang systemctl restart mariadb
-
查看mysql的版本信息
mysql -V
-
配置两台mysql
[root@localhost ~]# mysql MariaDB [(none)]> grant all on *.* to tom@'%' identified by '123'; MariaDB [(none)]> show master status; [root@localhost ~]# vim /etc/my.cnf server-id=2 log-bin=qi relay-log=wang mysql MariaDB