当前位置:网站首页>MySQL master-slave synchronization
MySQL master-slave synchronization
2022-06-30 20:08:00 【Study hard and love you hard!】
mysql install You need to install two
https://blog.csdn.net/weixin_45247019/article/details/124748512
Main library configuration
cd /mydata/mysql/conf
# Modify file
vi my.cnf
my.cnf
[mysqld]
# Open the binary log and specify the log name prefix
log-bin=mysql-bin
# Set unique library ID
server-id=1
Restart the service
service mysql restart
Add users ( Use from primary connection )
# Sign in mysql
mysql -u root -p
# Create user repl
mysql> CREATE USER 'replymeee'@'%' IDENTIFIED WITH mysql_native_password BY 'replymeee';
# Grant users repl From library related permissions
mysql> GRANT REPLICATION SLAVE ON *.* TO 'replymeee'@'%';
# Refresh the permissions
mysql> flush privileges;
Get the master library Log file and location
mysql> SHOW MASTER STATUS;

Configuration from library
cd /mydata/mysql/conf
# Modify file
vi my.cnf
my.cnf
[mysqld]
# Open the binary log and specify the log name prefix
log-bin=mysql-bin
# Set unique library ID
server-id=2
Restart the service
service mysql restart
Connect the main library
# Sign in mysql
mysql -u root -p
# Set main library parameters
mysql> CHANGE MASTER TO
MASTER_HOST='xxx.xxx.xxx.xxx', # Main library ip
MASTER_USER='replymeee', # user
MASTER_PASSWORD='replymeee', # password
MASTER_LOG_FILE='binlog.000006', # Binary
MASTER_LOG_POS=856; # Binary position
Turn on synchronization
start slave;
# Check the status
show slave status\G;

Author's statement
If there is a problem , Welcome to correct !
边栏推荐
- VR全景拍摄为什么要加盟?巧借资源实现共赢
- Unity 如何拖拉多个组件中的一个
- Growth summer challenge is coming, exclusive community welfare is coming ~ get CSDN customized T-shirt for free
- [ICLR 2021] semi supervised object detection: unbiased teacher for semi supervised object detection
- Cv+deep learning network architecture pytoch recurrence series basenets (backbones) (I)
- 解决arm_release_ver of this libmali is ‘g2p0-01eac0‘,rk_so_ver is ‘4‘,libgl1-mesa-dev不会被安装,存在未满足的依赖关系
- Ten percent of the time, the tar command can't parse the English bracket "()" when decompressing the file
- This morning, investors began to travel collectively
- 操作系统面试题汇总(不定期更新)
- Lombok
猜你喜欢

CADD课程学习(2)-- 靶点晶体结构信息

Torchdrug -- drug attribute prediction

Application of VoIP push in overseas audio and video services

Why must we move from Devops to bizdevops?

新出生的机器狗,打滚1小时后自己掌握走路,吴恩达开山大弟子最新成果

传输层 使用滑动窗口实现流量控制
MySQL数据库误删回滚的解决

RP原型资源分享-购物类App

计网 | 【五 传输层、六 应用层】知识点及例题
Solution to rollback of MySQL database by mistake deletion
随机推荐
Filebeat custom indexes and fields
pytorch实现FLOPs和Params的计算
十分之坑,tar命令解压文件的时候竟然不能解析英文括号“()”
企业中台规划和IT架构微服务转型
腾讯会议应用市场正式上线,首批入驻超20款应用
标配10个安全气囊,奇瑞艾瑞泽8安全防护无死角
Detailed steps for Django to upload excel tables and write data to the database
Wechat applets - basics takes you to understand the life cycle of applets (2)
达梦数据库重新初始化实例操作记录
超视频时代的音视频架构建设|Science和英特尔联袂推出“架构师成长计划”第二季
《微信小程序-基础篇》带你了解小程序中的生命周期(二)
Go语言学习教程(十三)
闲鱼难“翻身”
[ICLR 2021] semi supervised object detection: unbiased teacher for semi supervised object detection
Source code analysis of redis ziplist compressed list
VR全景拍摄为什么要加盟?巧借资源实现共赢
Advanced skills of testers: a guide to the application of unit test reports
将秒数转换为**小时**分钟
如何快速通过PMP考试?
KubeVela 1.4:让应用交付更安全、上手更简单、过程更透明