Search the MySQL manual:

4.10.9 Troubleshooting Replication

If you have followed the instructions, and your replication setup is not working, first check the following:

When you have determined that there is no user error involved, and replication still either does not work at all or is unstable, it is time to send us a bug report. We need to get as much information as possible from you to be able to track down the bug. Please do spend some time and effort preparing a good bug report.

If you have a repeatable way to demonstrate the bug, use mysqlbug to prepare a bug report and enter it into our bugs database at http://bugs.mysql.com/. If you have a phantom -- a problem that does occur but you cannot duplicate "at will" -- fortunately this rarely happens:

Once you have collected the evidence on the phantom problem, try hard to isolate it into a separate test case first. Then enter the problem into our bugs database at http://bugs.mysql.com/ with as much information as possible.

User Comments

Posted by Matt Warnock on Friday May 17 2002, @6:24am[Delete] [Edit]

Note that the default MySQL port is 3306 and that
this is the number that should normally be
specified in my.cnf on the slaves.

This info is given in the replication config file
page, but should be listed here too. You won't
find it under "ports" or "connections" in the
subject index.

Also, is this statement optional if the slaves
connect at the same port that they listen on?

Posted by [name withheld] on Friday May 17 2002, @6:24am[Delete] [Edit]

Note that if you client does not do a "USE
dbname", binlog-do-db=dbname will not binlog a
query like: "update in dbname.foobar set foo=1"

You explicitly have to do a USE before a query in
order to have your query binlogged, it looks
like. Replication on the slave side can do
wildcard matches .. but the master cannot (a la
binlog-wild-do-table=dbname.%). So make sure your
clients do a use, if you plan to replicate those
tables it updates.

Posted by [name withheld] on Friday May 17 2002, @6:24am[Delete] [Edit]

for MySQL v3.23.28:
When you attempt to use a certain master-
user/master-password combo to connect to the
mysql master, and you later change my.cnf to
attempt to connect with a new user, you must
update master.info to reflect the changes.

Since my master.info file only had one entry in
it (the slave only has one master), I simply
deleted the file. Upon restarting the slave
daemon, a new master.info was automatically
written.

--Curby

Posted by Ed McGuigan on Friday May 17 2002, @6:24am[Delete] [Edit]

If you need to roll your own log file rotation
script as I did, and you are familiar with Perl,
look at the Log::Rotate module on CPAN rather
than reinventing the wheel.

Posted by Brian Duggan on Friday May 17 2002, @6:24am[Delete] [Edit]

Using release 3.23.42-1, the grant file command
didn't work for me when specifying a specific
database, and I found it necessary to modify the
File_priv column in the user table directly.

Posted by Renato Golin on Friday May 17 2002, @6:24am[Delete] [Edit]

If you intend to use "load table from master" you need to have access to that table to "rep" user, unlike this sections says of only having to set "File_priv" to "rep" user for all bases.

Posted by Jesse Thompson on Friday May 17 2002, @6:24am[Delete] [Edit]

Above on this page where it talks about "properly
modularized and abstracted code" and refers to
safe_reader_query() and safe_writer_query(), I'd
like to put forth the proposition that different
abstracted functions for reading and writing need
not be nessessary for compliance with replication.

We currently have all of our queries running
through One safe-sql envelope, and we intend to
keep this architecture as we move to replication
by telling our envelope to send any queries that
begin with /\s+select/i to the slave, and
anything else to the master. We are running under
the assumption that all "read queries" are
selects. I can't think of any that aren't. If
there were they would probably be nominal in
performace draw (we use many complex select
statements :) and wouldn't do any harm being
handled by the master anyway.

So far as multi-statement queries, are code
doesn't, and won't, mix selects in the same query
with non-selects, or probably even use more than
one select per query, since we're not certain
what results could be returned in such a
circumstance. Thus reading and writing should
never get mixed up in the same query, and all
reads should start with the word "Select".

If you feel that my theory holds water then give
it a go, if you see a flaw in my logic before I
do mail me and lemme know, eh? 10x :)

- - Jess

Posted by Jeff Allen on Friday May 17 2002, @6:24am[Delete] [Edit]

When I started up my slave the first time, I had
been using binary logging for some time on the
master. I had already removed $hostname-bin.001
long ago. The slave complained about not being
able to find the first log and would not start
replaying transactions. To fix this, I stopped
the master, made a new snapshot, moved "*-bin.*"
to another directory, and started the master
again. Then when I put the snapshot on the slave
and started it, everything worked correctly.

Posted by Jesse Thompson on Friday May 17 2002, @6:24am[Delete] [Edit]

Above where it says to add options to the slave
machine's /etc/my.cnf, it's not explicit but you
DO need to add them to the [mysqld] section. If
you add them to some other section by mistake
mysql will behave as though it doesn't know you
want it to slave. It will tell you you haven't
configured it to slave, and no errors will occur
in the log.

Good luck with all of your replicating needs :)

- - Jess

Posted by Jonathon Padfield on Friday May 17 2002, @6:24am[Delete] [Edit]


If you want your slaves to connect to the
replication server with a unique username &
password and minimal privileges, you need to grant
just the FILE privilege to your replication user.

Similarly, if your slaves have no local updates
made on them, just lots of selects, its a very
good idea to connect with a user that cannot
update the data. This stops dead any chance of
mistakenly connecting to the wrong DB and losing
updates.

Posted by joshua paul on Friday May 17 2002, @6:24am[Delete] [Edit]

With verion 3.23.41 - I couldn't get replication
to work following the instructions about.
Specifically I got errors when I created
the "repl" user before copying data to the slave.
I could only get replication to work if I created
the "repl" user after copying data to the slave -
and obviously starting both servers...

Posted by Jason de Cordoba on Friday May 17 2002, @6:24am[Delete] [Edit]

Using Mysql 3.23.46 We tried to use the
mysqld option --bind-address=xxx.xxx.xxx.xxx to
bind the slave to a piticular IP address, one
that is directed away from visitor traffic on a
seperate ethernet device. We found in fact
mysqld was only available via the specified ip
but the slave host did not have the same
behavior. Since the slave is running under
mysqld why does --bind-address have no
effect?

Posted by [name withheld] on Friday May 17 2002, @6:24am[Delete] [Edit]

Note: If you are running WinMySQLAdmin, you will
have to make the changes in the my.ini file as
well. It took me a while to realize this.

Posted by Chad Kouse on Friday May 17 2002, @6:24am[Delete] [Edit]

incredibly helpful page. I do have one issue to
raise - I have two servers doing 2-way
replication. One is on Linux, and one is on
Windows. There is an issue of case-sensitivity
in that if case is not taken into consideration
on the windows machine, the slave on the linux
machine stops. I'd love to hear any fixes to
this: chad@toohome.com

Posted by [name withheld] on Friday May 17 2002, @6:24am[Delete] [Edit]

I also had the problem Allen pointed out above,
in my case I had not actually deleted any of the
binary log files which the slave still required
to update from (I knew this courtesy of "show
slave status" command). But I had deleted several
log files it had finished with. I was able to fix
this without making a brand new snapshot (which
in my case took a larger outage that I would
like) What I did was edit the file (in the
Masters logs directory) $hostname-bin.index and
edited entries to show exact filenames of my
remaining binary log files.(ie: removing the
entries matching ones I had deleted manually from
the file system) I quickly did a mysql stop and
mysql start after that and I performed the
command "slave stop; slave start;" on the slave
and it started replicating again. I am running
version 3.23.41

Posted by David Dombek on Thursday January 30 2003, @9:17am[Delete] [Edit]

Mysql 3.23.49
When a slave is running you have a master.info file. If you change the slave to become the master you must delete the master.info file or you may get errors such as this:

030130 10:57:03 Slave thread: error connecting to master: Unknown MySQL Server Host '' (4) (107), retry in 60 sec

It will keep retrying every 60 sec. Just deleting the master.info file worked for me.

Posted by tace on Thursday February 6 2003, @1:59am[Delete] [Edit]

I wouldn't suggest running replication on machines with different os. I had win2000 running MySQL server as well a RedHat Linux 7.3 with MySQL server as well. When the client code on Linux tried to connect to win2000 MySQL server, the server died, with win2000 reporting it has terminated.
Still haven't figure out what happened

Posted by Alban Hasa on Sunday March 9 2003, @10:42am[Delete] [Edit]

If the slave doesn't find the master host, it stays in thread "connectin to master" and at 90% my MySQL Server version 3.23.54 dies.

I made an error during replication setup, I wrote the wrong IP address for the master. But this is a great problem when the master server goes down. Can anyone have a solution for this? Please Help

Posted by Mallikarjun BM on Wednesday June 25 2003, @10:46pm[Delete] [Edit]

Mysql replication suddenly stops. When i check this command mysql>show slave status

It shows SLAVE_IO_RUNNING is NO but SLAVE_SQL_RUNNING is YES.

In this situtaion what are steps i need to follow.

Thanks in advance

Add your own comment.