mysql主从同步配置
主:192.168.199.200
从:192.168.199.201
1.主mysql开启binlog功能
/etc/my.cnf #配置文件 [mysqld] log_bin = /data/mysql/mysql_m-bin #开启binlog
2.重启mysql,后生成日志文件
cat /data/mysql/mysql_m-bin.000001 #把里面记录的日志文件名记录下来等一下从库要用到
3.创建用户并授权
mysql -uroot -p grant replication slave on *.* to "cs-1"@"192.168.199.%"identified by "wangwei"; flush privileges;
4.查看主库id和状态
SHOW VARIABLES LIKE ‘server_id‘; #查看id SET GLOBAL server_id=1; #修改id,保证主从库id不同
相关推荐
emmm00 2020-11-17
暗夜之城 2020-11-11
疯狂老司机 2020-09-08
CoderToy 2020-11-16
王艺强 2020-11-17
ribavnu 2020-11-16
bianruifeng 2020-11-16
wangshuangbao 2020-11-13
苏康申 2020-11-13
vivenwan 2020-11-13
moyekongling 2020-11-13
云中舞步 2020-11-12
要啥自行车一把梭 2020-11-12
aydh 2020-11-12
kuwoyinlehe 2020-11-12
minerk 2020-11-12
vitasfly 2020-11-12
jazywoo在路上 2020-11-11