Name

START SLAVE

Synopsis

START SLAVE [IO_THREAD|SQL_THREAD]

START SLAVE [SQL_THREAD]
   UNTIL MASTER_LOG_FILE = 'log_filename', MASTER_LOG_POS = position
START SLAVE [SQL_THREAD]
   UNTIL RELAY_LOG_FILE = 'log_filename', RELAY_LOG_POS = position

Use this statement to start a slave server. In the first syntax, you can start just the I/O thread or just the SQL thread by using the respective keyword. You can start both by listing both keywords, separated by a comma. The default is to start both. The I/O thread reads SQL queries from the master server and records them in the relay log file. The SQL thread reads the relay log file and then executes the SQL statements. See the Replication Process” section earlier in this chapter for details.

The second syntax limits the reading of the threads to a specific point, given with MASTER_LOG_POS, in the master log file named with the MASTER_LOG_FILE parameter. The UNTIL clause stops processing of the given log files when the given position is reached. The third syntax specifies the relay log file and limits its reading and execution. If the SQL_THREAD keyword is given in either the second or third syntaxes, the reading will be limited to the SQL thread.

The starting of a slave thread isn’t always dependable. Run the SHOW SLAVE STATUS statement to confirm that the thread began and remained running.

Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.