START SLAVE [
thread_types] START SLAVE [SQL_THREAD] UNTIL MASTER_LOG_FILE = '
log_name', MASTER_LOG_POS =
log_posSTART SLAVE [SQL_THREAD] UNTIL RELAY_LOG_FILE = '
log_name', RELAY_LOG_POS =
thread_type] ... ]
thread_type: IO_THREAD | SQL_THREAD
START SLAVE with no
thread_type options starts both of
the slave threads. The I/O thread reads events from the master
server and stores them in the relay log. The SQL thread reads
events from the relay log and executes them.
START SLAVE requires the
START SLAVE succeeds in
starting the slave threads, it returns without any error.
However, even in that case, it might be that the slave threads
start and then later stop (for example, because they do not
manage to connect to the master or read its binary log, or some
START SLAVE does
not warn you about this. You must check the slave's error log
for error messages generated by the slave threads, or check that
they are running satisfactorily with
START SLAVE sends an
acknowledgment to the user after both the I/O thread and the SQL
thread have started. However, the I/O thread may not yet have
connected. For this reason, a successful
START SLAVE causes
SHOW SLAVE STATUS to show
Slave_SQL_Running=Yes, but this does not
Slave_IO_Running=Yes only if the I/O thread
is running and connected). For more
information, see Section 220.127.116.11, “SHOW SLAVE STATUS Syntax”, and
Section 18.104.22.168, “Checking Replication Status”.
You can add
SQL_THREAD options to the statement to name
which of the threads to start.
UNTIL clause may be added to specify that
the slave should start and run until the SQL thread reaches a
given point in the master binary log or in the slave relay log.
When the SQL thread reaches that point, it stops. If the
SQL_THREAD option is specified in the
statement, it starts only the SQL thread. Otherwise, it starts
both slave threads. If the SQL thread is running, the
UNTIL clause is ignored and a warning is
UNTIL clause, you must specify both a
log file name and position. Do not mix master and relay log
UNTIL clause can be useful for debugging
replication, or to cause replication to proceed until just
before the point where you want to avoid having the slave
replicate an event. For example, if an unwise
DROP TABLE statement was executed
on the master, you can use
UNTIL to tell the
slave to execute up to that point but no farther. To find what
the event is, use mysqlbinlog with the master
binary log or slave relay log, or by using a
SHOW BINLOG EVENTS statement.
If you are using
UNTIL to have the slave
process replicated queries in sections, it is recommended that
you start the slave with the
--skip-slave-start option to
prevent the SQL thread from running when the slave server
starts. It is probably best to use this option in an option file
rather than on the command line, so that an unexpected server
restart does not cause it to be forgotten.
SHOW SLAVE STATUS statement
includes output fields that display the current values of the
In old versions of MySQL (before 4.0.5), this statement was
SLAVE START. This usage is still
accepted in MySQL 5.1 for backward compatibility,
but is deprecated and is removed in MySQL 5.6.