START SLAVE

Use this MySQL statement to start a slave server.

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

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

Explanation

Use this MySQL statement to start a slave server for replication. In the first syntax above, 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 MySQL statements.

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 of 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.

Examples

Below is an example of this MySQL statement:

START SLAVE;

As you can see, unless you want to limit the starting of the slave to certain types of threads or are restoring from a log, there's not much to this statement.