Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure Mysql Master-Slave Service

2025-04-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "how to configure Mysql master-slave service", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to configure Mysql master-slave service" this article.

Configure the Mysql master-slave service implementation instance

# configure the master database my.cnf

Server-id=1log-bin=master-binlog-bin-index=master-bin.index

# create a synchronization account on the master database

Create user backup;GRANT REPLICATION SLAVE ON *. * TO 'backup'@'192.168.%.%' IDENTIFIED BY' mysql'

# configure my.cnf from database

Server-id=2relay-log-index=slave-relay-bin.indexrelay- log=slave-relay-bin

# restart mysql service

Service mysqld restart

# Connect to Master service

Change master to master_host='192.168.91.128',master_port=3306,master_user='backup',master_password='mysql',master_log_file='master-bin.000001',master_log_pos=0

# start slave service

Start slave

# View the status of Master service

SHOW MASTER STATUS

# View the status of Slave service

SHOW slave STATUS\ G

# check whether the server_id is the same and needs to be different

Show variables like 'server_id'

Common mistakes

Error: Fatal error: The slave Imax O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.

Solution: check whether the server-uuid=* in the auto.cnf in the data directory is the same, and change it to different

The above is all the contents of the article "how to configure Mysql Master and Slave Services". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report