When the data volume of the database is frequently read and written, we should consider separating the reading and writing of the database to improve the efficiency of the database, (of course, there are other uses such as backup data), this time we need to use a MySQL function, database synchronization. The following is a detailed implementation of the method
First, the system environment
Primary Database (Master):
System: Windows
Database: MySQL 5.0.51
ip:192.168.1.156
From the database (slave):
System: Linux
Database: MySQL 5.0.67
ip:192.168.1.154
Second, configuration parameters:
The network said that the two database configuration must be consistent, but also the two configuration files to the handcuffs. It seems to make sense because some of the features are not consistent and may cause synchronization errors. But my two MySQL systems are different, so follow the default installation configuration.
Database preparation:
The database to synchronize is called account
Then you must put the account and data on the primary server to the slave server.
and open an account on the primary server that allows access from the server.
Primary database (Master) configuration:
Modify MySQL configuration file my.cnf,
Locate the Server-id line and change the following
Server-id = 1
and add two lines of necessary information:
Log-bin = D:/log-bin.log #二进制变更日值的存放位置
binlog-do-db = Account #要同步的数据库