MySQL data synchronization to achieve

It describes the environment, two computers installed MySQL (IP 192.168.1.99 and 192.168.1.100, respectively), the machine A and B became machine.

Now we want to synchronize database on the A to B.

1, the preparatory work, and the new database table with the same structure on B;

2, modify My.ini arranged on machine A, the following

server-id=1 
log-bin=d:\mysqlback
binlog-do-db=DBname

 

Add machine B 3, A machine access privileges

GRANT REPLICATION SLAVE,RELOAD,SUPER ON *.* TO [email protected] IDENTIFIED BY  'password' ;

A machine restart MySQL service, you can see the d: \ mysqlback new file is generated.

4, modify B My.ini machine configuration

server-id=2  
master-host=192.168.1.99
master-user=username
master-password=password
master-connect-retry=60
replicate-do-db=DBname

 MySQL5.3 later versions do not support the master and other parameters, to be executed in MySQL

change master to master_host='192.168.1.99', master_user='username', master_password='password';

My.ini configuration, as follows

B machine to restart MySQL service

server-id=2
replicate-do-db=DBname()

 

5, test, A machine, enter a record updates immediately whether B

 

To AB machine synchronized with each other (corresponding to the AB again intermodulation rearrangement)

6, A configuration increases the
replicate-do-db = DBname

7, B is added

log-bin=E:\mysqlback
binlog-do-db=ggz

At the same time, execute commands and authorization master_host command. ()
---------------------
Author: qmy031
Source: CSDN
Original: https: //blog.csdn.net/qmy031/article/details/75009677
copyright notice : This article is a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin www.cnblogs.com/HKROnline-SyncNavigator/p/10972088.html