Hi all,

I'm busy setting up replication and have encountered what looks like a bug
in mysqldump. The following commands work perfectly:

Running the following commands in the mysql client on the slave:
stop slave;
reset slave;
create database dbName;
CHANGE MASTER TO MASTER_HOST='masterHost', MASTER_USER='root',
MASTER_PASSWORD='mypass';

Then running the following on the command line on the slave:

mysqldump --single-transaction --master-data=1 -u root -pmypass -h
masterHost dbName >masterDB.sql ;

mysql -u root -pmypass -h slaveHost dbName< masterDB.sql

Then running the following in the mysql client on the slave:

start slave;

At this point the slave comes up perfectly and is in sync with the master.

However, if I do exactly the same thing, but import the data using a pipe
command:

mysqldump --single-transaction --master-data=1 -u root -pmypass -h
masterHost dbName | mysql -u root -pmypass -h slaveHost dbName

When i start the slave I get a duplicate key error. In other words, the
slave is trying to execute entries in the masters log that have already been
run.

I can't figure out why this is a problem and this has forced me to store
data on disk as a file as an intermediate step when setting up slaves.

The only difference between the two methods is that in the first case the
data is stored on disk and then imported via the client and in the second
case it's piped directly to the client. In both cases the data that
mysqldump produces is the same. Both include the CHANGE MASTER command that
sets the log file and position.

Is this a bug in mysqldump, or am I missing something?

Thanks in advance,

Mark.

Reply via email to