The following article mainly introduces the MySQL master-slave in windows operating system. The reason why MySQL master-slave can be widely used in a short time is as follows, this is also because of its unique functions. The following articles describe the functions of MySQL master-slave in windows.
MySQL replication settings
- Set up MySQL replication and control slave thread
MySQL master-slave backup
Recommendation circle: Database circle
For more information, we recommend that you install MySQL
1. install two MySQL instances first, that is, copy a MySQL instance (MySQL5.1 and MySQL5.2)
2. Modify the port number and installation address (my. ini). Here we do not use the default port 3306 for main tests.
Xml Code
- MySQL5.1
- [client]
- port=3307
- [MySQLd]
- port=3307
- basedir="E:/MySQL5.1/"
- datadir="E:/MySQL5.1/Data/"
- MySQL5.2
- [client]
- port=3308
- [MySQLd]
- port=3308
- basedir="E:/MySQL5.2/"
- datadir="E:/MySQL5.2/Data/"
- MySQL5.1
- [client]
- port=3307
- [MySQLd]
- port=3307
- basedir="E:/MySQL5.1/"
- datadir="E:/MySQL5.1/Data/"
- MySQL5.2
- [client]
- port=3308
- [MySQLd]
- port=3308
- basedir="E:/MySQL5.2/"
- datadir="E:/MySQL5.2/Data/"
3. Create a backup account in the database of the Master (MySQL master-slave). The command is as follows:
SQL code
- GRANT REPLICATION SLAVE ON *.* TO 'slave'@'localhost' IDENTIFIED BY '123456';
- GRANT REPLICATION SLAVE ON *.* TO 'slave'@'localhost' IDENTIFIED BY '123456';
-
4. Modify Master to MySQL5.1 as follows (my. ini ):
Xml Code
[MySQLd]
# Master start
# Log output addresses are mainly used for synchronization
Log-bin = E: \ MySQL5.1 \ Data \ log-bin.log
# Synchronize Databases
Binlog-do-db = cnb
# The host id cannot be the same as the slave id
Server-id = 1
# Master end
[MySQLd]
# Master start
# Log output addresses are mainly used for synchronization
Log-bin = E: \ MySQL5.1 \ Data \ log-bin.log
# Synchronize Databases
Binlog-do-db = cnb
# The host id cannot be the same as the slave id
Server-id = 1
# Master end
The above content is an introduction to MySQL master-slave in windows. I hope you will have some gains.