mysqld-nt.exe --install "MySQL1" --defaults-file="C:\Program Files\MySQL\MySQL Server 5.0\my2.ini"
net start mysql
net start mysql1
mysql -uroot -p --port=3306
mysql -uroot -p --port=3307
* It will prompt for password, on success you will end up logging in both mysql servers.
Create database master;
Use master;
CREATE TABLE `temp` (
`id` int(10) NOT NULL auto_increment,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
binlog-do-db=master
mysql> Grant replication slave on *.* to 'replication1'@'localhost' identified by 'slave1';
#Conn. Pmtr for slave:
master-host = localhost
master-user = replication1
master-password = slave1
master-port = 3307
net start mysql
binlog-do-db=master
net start mysql1
mysql> Grant replication slave on *.* to 'replication2'@'localhost' identified by 'slave2';
#Conn. Pmtr for slave:
master-host = localhost
master-user = replication2
master-password = slave2
master-port = 3306
- Start Slave Server:
net start mysql
mysql>Start Slave;
** Check for working Master-Slave **##my.ini for mysql (Regularly installed):
[client]
port=3306
[mysqld]
server-id=2
port=3306
# Replication
log-bin=binlog
#For this as master:
binlog-do-db=master
binlog-ignore-db=mysql
binlog-ignore-db=test
#Conn. Pmtr for slave:
master-host = localhost
master-user = replication1
master-password = slave1
master-port = 3307
basedir="C:/Program Files/MySQL/MySQL Server 5.0/"
datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data/"
auto_increment_increment=1
auto_increment_offset=1
Following is the my2.ini [configuration] file for second MySQL instance named "mysql1":
##my2.ini for Mysql1:
[client]
port=3307
[mysqld]
server-id=1
port=3307
# Replication
log-bin=binlog
#For this as master:
binlog-do-db=master
binlog-ignore-db=mysql
binlog-ignore-db=test
#Conn. Pmtr for slave:
master-host = localhost
master-user = replication2
master-password = slave2
master-port = 3306
basedir="C:/Program Files/MySQL/MySQL Server 5.0/"
datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data1/"
auto_increment_increment=1
auto_increment_offset=2
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (0)