MySQueaL Resources

resources for mysql admins and developers who are squealing for help

More Resources

Main Doc Pages
Comments
MySQL columns: everywhere I look are tables and columns; life is filled with databases of information to be ordered and grouped. (Ca'Grande, Milan, Italy)

START SLAVE Statement

Use this MySQL statement to start a slave server.

hits past month: 18 ;  last updated: may 4, 2009 - 2:34am ;  parent: MySQL Replication

Syntax

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.

Return to MySQL Replication page of our MySQL Documentation