START SLAVE
Syntax
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 SUPER
privilege.
If 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 other problem). 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 SHOW SLAVE STATUS
.
MySQL 5.6.4 and later supports pluggable user-password authentication with START SLAVE
with the USER
, PASSWORD
, DEFAULT_AUTH
and PLUGIN_DIR
options, as described in the following list:
USER
: User name. Cannot be set to an empty or null string, or left unset ifPASSWORD
is used..PASSWORD
: Password.DEFAULT_AUTH
: Name of plugin; default is MariaDB native authentication.PLUGIN_DIR
: Location of plugin.
See , "Pluggable Authentication", for more information.
The SQL_THREAD
option cannot be used with any of the options in the preceding list. The IO_THREAD
option can be used, but is ignored.
If DEFAULT_AUTH
is unspecified, the username and password are stored in the master.info
repository. If an insecure connection is used with any these options, the server issues the warning Sending passwords in plain text without SSL/TLS is extremely insecure.Note
It is possible to view the entire text of a running START SLAVE ...
statement, including any USER
or PASSWORD
values used, in the output of SHOW PROCESSLIST
. This is also true for the text of a running CHANGE MASTER TO
statement, including any values it employs for MASTER_USER
or MASTER_PASSWORD
.
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 guarantee that Slave_IO_Running=Yes
(because Slave_IO_Running=Yes
only if the I/O thread is running and connected). For more information, see , "SHOW SLAVE STATUS
Syntax", and , "Checking Replication Status".
You can add IO_THREAD
and SQL_THREAD
options to the statement to name which of the threads to start. In MariaDB 5.6.4 and later, the SQL_THREAD
option is disallowed when specifying USER
, PASSWORD
, or both (Bug #13083642).
An 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 issued.
The UNTIL
clause is currently not supported for multi-threaded slaves (MySQL 5.6.3 and later).
For an UNTIL
clause, you must specify both a log file name and position. Do not mix master and relay log options.
Any UNTIL
condition is reset by a subsequent STOP SLAVE
statement, a START SLAVE
statement that includes no UNTIL
clause, or a server restart.
You can use the IO_THREAD
option with START SLAVE ... UNTIL
even though only the SQL thread is affected by this option. The IO_THREAD
option is ignored in such cases.
The 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.
The SHOW SLAVE STATUS
statement includes output fields that display the current values of the UNTIL
condition.
In old versions of MariaDB (before 4.0.5), this statement was called SLAVE START
. That syntax is no longer accepted as of MariaDB 5.6.1.