MySQL bidirectional synchronization solution:

Source: Internet
Author: User

Database A's Host IP address is 192.168.239.131, database B's Host IP address is 192.168.239.1, the operating system is Windows XP, and the database name is TT

I,Database A requires the following settings:

Open the my. ini file and add several lines at the end (the directory specified by log-bin must exist ):
Server-id = 1
Log-bin = C :\mysqllog \ log-bin.log
BINLOG-do-DB = TT
Master-host = 192.168.239.131
Master-user = test
Masters-Password = 1234
Master-Port = 3306
Master-connect-retry = 60
Replicate-do-DB = TT

Log on to MYSQL as root and create a user logging on to machine B:

Grant replication slave, reload, super on *. * To test @ '192. 168.239.131 'identified by '2016 ';

II,Database B requires the following settings:

Open the my. ini file and add several lines at the end (the directory specified by log-bin must exist ):
Server-id = 2
Log-bin = C :\mysqllog \ log-bin.log
BINLOG-do-DB = TT
Master-host = 192.168.239.1
Master-user = test
Masters-Password = 1234
Master-Port = 3306
Master-connect-retry = 60
Replicate-do-DB = TT

Log on to MYSQL as the root user and create a user to log on to server:

Grant replication slave, reload, super on *. * To test @ '192. 168.239.1 'identified by '123 ';

Iii. Restart database A and database B

Iv. Database B execution
Slave start;

V. View status of A and B respectively
Mysql> show Master status;

6. Delete the master.info files of database A and database B respectively.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.