Mysql主主配置
程序员文章站
2022-06-07 22:24:27
1.vim /etc/my.cnf 2.service mysqld restart 3.进入 Mysql 4.进入从服务器 5.vim /etc/my.cnf 6.进入从Mysql 配置主主,从第6步在主服务器上重复操作 ......
1.vim /etc/my.cnf
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 server-id=1 log_bin=mysqlbin relay_log=relaylog [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
2.service mysqld restart
3.进入 mysql
mysql> grant all on *.* to tom@'192.168.146.%' identified by '123';
query ok, 0 rows affected (0.00 sec)
mysql> flush privileges;
query ok, 0 rows affected (0.00 sec)
4.进入从服务器
5.vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
server-id=2
log_bin=mysqllog
relay_log=mysqlrelay
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
6.进入从mysql
mysql> stop slave;
query ok, 0 rows affected, 1 warning (0.00 sec)
mysql> change master to master_host='192.168.146.6', master_user='tom',master_password='123',master_log_file='mysqlbin.000003',master_log_pos=315;
query ok, 0 rows affected (0.39 sec)
mysql> start slave;
query ok, 0 rows affected (0.00 sec)
mysql> show slave status \g;
配置主主,从第6步在主服务器上重复操作
推荐阅读
-
在ASP.NET 2.0中操作数据之三十四:基于DataList和Repeater跨页面的主/从报表
-
C# winform主界面打开并关闭登录界面的方法
-
MySQL解压版配置步骤详细教程
-
Java获取彩色图像中的主色彩的实例代码
-
利用PS制作简单的主背景模板
-
mysql 5.7.17 安装配置方法图文教程(windows10)
-
mysql 5.7.13 winx64安装配置方法图文教程(win10)
-
MySQL 5.7.13 源码编译安装配置方法图文教程
-
mysql 5.7.17 安装配置方法图文教程(ubuntu 16.04)
-
mysql 5.7.10 winx64安装配置方法图文教程(win10)