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 master slave data synchronization in MYSQL5

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article will explain in detail how to configure master slave data synchronization in MYSQL5. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Test environment. Basically, the data is synchronized in an instant. I hope it will be helpful to everyone.

RedHat ES 3 update 3

MYSQL 5.0.15

MYSQL data synchronous backup

A server: 192.168.1.2 main server master

Server B: 192.168.1.3 secondary server slave

A server settings

# mysql-u root-p

Mysql > GRANT FILE ON *. * TO backup@192.168.1.3 IDENTIFIED BY '1234'

Mysql > exit

Above, Master opens an account, backup password 1234, and gives IP:192.168.1.3 permission to process files.

Mysqladmin-u root-p shutdown

Export the Master database to the slave machine, and you can choose to export the database that needs to be synchronized

Modify / etc/my.cnf on machine A

Add parameters in the [mysqld] section

Log-bin=mysql-bin

Server-id=1

Binlog_do_db = gbbbs (database to be synchronized)

Binlog_ignore_db = mysql,test,information_schema (libraries that do not require synchronization, information_schema is available in 5.0)

Sql-bin-update-same

Restart server A mysql

B server settings

Settings / etc/my.cnf

Add in the [mysqld] section

Server-id= 2 (if there are still slave users, their ID will also increase, such as server-id=3)

Master-host = 192.168.112.71

Master-user = backup

Master-password = 1234

Replicate-do-db = gbbbs

# replicate-do-db = database2

Log-warnings

Master-port=3306

Master-connect-retry = 60

Restart the MYSQL of server B

There is a master.info file in the folder of the database to view synchronization information

Actually, it's MYSQL Replicatio.

This is the end of the article on "how to configure master slave data synchronization in MYSQL5". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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