Core tip: MySQL provides database replication functionality after version 3.23.15. The function of two database synchronization, master-slave mode and mutual backup mode can be realized by using this feature.
The settings for database synchronization replication are reflected in the MySQL settings file. MySQL configuration file (typically MY.CNF)
In a UNIX environment, in/ETC/MYSQL/MY.CNF or under the MySQL user's home directory my.cnf.
Window environment, if there is a my.cnf file under the C: root directory, the configuration file is taken. When running MySQL's Winmysqladmin.exe tool, the tool will name the MY.CNF in the C: root directory as Mycnf.bak. and create the My.ini in the Winnt directory. The MySQL server reads this profile when it is started. So you can copy the contents of the MY.CNF to the My.ini file and use the My.ini file as the MySQL server configuration file.
To set the method:
Set up the sample environment:
Operating system: window2000 Professional
Mysql:4.0.4-beta-max-nt-log
A ip:10.10.10.22
B ip:10.10.10.53
A: Set
1. To increase the user's most synchronized user account:
GRANT FILE on *.* to backup@ ' 10.10.10.53 ' identified by ' 1234 '
2. Add a database as a synchronization database:
Create DATABASE backup
B: Set
1. To increase the user's most synchronized user account:
GRANT FILE on *.* to backup@ ' 10.10.10.22 ' identified by ' 1234 '
2. Add a database as a synchronization database:
Create DATABASE backup
Master-slave mode: a->b
A is master
Modify a MySQL My.ini file. In the MYSQLD configuration entry, add the following configuration:
Server-id=1
Log-bin
#设置需要记录log can set the directory of the Log-bin=c:mysqlbakmysqllog settings log file,
#其中mysqllog是日志文件的名称, MySQL will build several log files with different extensions and file names Mysqllog.
Binlog-do-db=backup #指定需要日志的数据库
Restart the database service.
Use the Show Master Status command to see the log.
b for Slave