当前位置:网站首页>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 !
边栏推荐
猜你喜欢

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

Unity 如何拖拉多个组件中的一个

This morning, investors began to travel collectively

昔日果汁大王,16个亿卖了

FH6908A负极关断同步整流模拟低压降二极管控制IC芯片TSOT23-6超低功耗整流器 1w功耗 <100uA静态 替代MP6908
![[multithreading] use the thread pool to implement a simple thread pool](/img/24/ad3ced1d4aebde3f2233b04752bead.png)
[multithreading] use the thread pool to implement a simple thread pool

腾讯会议应用市场正式上线,首批入驻超20款应用

闲鱼难“翻身”

2022年高考都结束了,还有人真觉得程序员下班后不需要学习吗?

8 - function
随机推荐
QT :QAxObject操作Excel
Convert seconds to * * hours * * minutes
【LeetCode】【SQL】刷题笔记
The former king of fruit juice sold for 1.6 billion yuan
重复乃技艺之母
RP原型资源分享-购物类App
neo4j load csv 配置和使用
【论文阅读】Trajectory-guided Control Prediction for End-to-end Autonomous Driving: A Simple yet Strong Baseline
Warmup预热学习率「建议收藏」
mysql主从同步
Cv+deep learning network architecture pytoch recurrence series basenets (backbones) (I)
Solution to rollback of MySQL database by mistake deletion
composer
C语言:hashTable
How unity pulls one of multiple components
Filebeat自定义index和fields
MySQL billing Statistics (Part 1): MySQL installation and client dbeaver connection
Audio and video architecture construction in the super video era | science and Intel jointly launched the second season of "architect growth plan"
MySQL数据库查询优化
毕业季职场人