win2003 installs two mysql instances as master slave synchronous service configurations

  • 2020-05-10 23:00:40
  • OfStack

Preparation before configuration:
Two computers, all installed with windows2003 64-bit. c,d,e. Computer name 1 is Master,1 is slave.
Use mysql-noinstall-mysql 5.1.50 zip.
First install mysql on the D disk of the Master computer.
1: unzip mysql-noinstall-5.1.50. Copy the contents to mysql 5.1 on D drive.
2: install mysql 5.1.50
Enter the cmd.
cd d:\mysql5.1\bin
mysqld install mysql5.1 // install mysql service named mysql5.1
3: configure my.ini. The following are required
default-character-set =utf8 // default font for database tables
basedir=D:\mysql5.1
datadir=D:\mysql5.1\data
port=3306
Configure the primary server so that log-bin must be turned on at my.ini
log-bin=mysql-bin
log=D:\mysql5.1\logs\mylog.log
Slow query logging and error logging can also be enabled accordingly.

my.ini must also be set
server_id=10
Do not use the default 1.
save
4: configure the registry
hklm-system-controlset-service-mysql5.1. Find imagepath and modify the key value
The default key value is :D:\ mysql5.1 \bin\mysqld msyql5.1
Change to :D:\ mysql5.1 \bin -- defaults-file ="D:\ mysql5.1 \ my.ini "mysql5.1
Save to exit.
Now you can start the mysql5.1 service and enter cmd.
net start mysql5.1
Install mysql 5.1.50 on the slave computer
1: unzip the file to mysql5.1 on D disk
2: install mysql5.1
Enter the cmd.
cd d:\mysql5.1\bin
mysqld install mysql5.1
3: configure my.ini from the server
basedir=D:/mysql5.1
datadir=D:/mysql5.1/data
default-character-set=utf8
server_id=11
This value is required, and the uniqueness must be guaranteed
The following are optional
log-bin=mysql-bin
log=d:/mysql5.1/logs/mylog.log
log-error=d:/mysql5.1/logs/error.log
log-slow-queries=d:/mysql5.1/logs/slowquery.log
relay_log=mysql-relay-bin
log_slave_updates=1
read_only=1
3: modify the registry of the primary server like 1. imagepath values.
4: start mysql 5.1 service
The D disk mysql instance of the master slave server above has been installed
Then go back to the master main server
Enter the mysql database
> cd d:\mysql5.1\bin
> mysql -uroot
mysql > grant replication slave,replication client on *.* to zjj@%27%%27 identified by '1';
Exit the msyql database
Back to slave from the server
Enter the mysql database
> cd d:\mysql5.1\bin
> mysql -uroot
mysql > change master to
- > master_host='master',
- > master_user='zjj',
- > master_password='1',
- > master_port=3306,
- > master_log_file='mysql-bin.000001',
- > master_log_pos=0;
mysql > start slave
This opens the master-slave service for one instance.
Configure the master-slave service for the instance of the E disk in the same way as in 1 above.
Note that the path is written correctly. Then in the configuration of my.ini, server_id must remain singleton. port avoid using 3306. The service name should be the same as mysql5.1.

Related articles: