mysql 主从同步-读写分离
主从同步与读写分离测试 一、 实验环境(主从同步) Master centos 7.3 192.168.138.13 Slave centos 7.3 192.168.138.14 二、在master操作 安装并配置文件 [root@localhost ~]# yum install mariadb-server -y [root@localhost ~]# cat /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock server-id=1 //必须唯一 log-bin=mysql-bin //开启binlog日志 character-set-server=utf8 //设置字符集 2.启动mysql [root@localhost ~]# systemctl start mariadb 3. 授权root用户 MariaDB [(none)]> grant all on *.* to root@'localhost' identified by '123456'; MariaDB [(none)]> grant all on *.* to root@'%' identified by '123456'; 4. 刷新权限表 MariaDB [(none)]> flush