JavaScript Editor Source code editor     What Is Ajax 

Main Page

6.8. Replication Startup Options

This section describes the options that you can use on slave replication servers. You can specify these options either on the command line or in an option file.

On the master and each slave, you must use the server-id option to establish a unique replication ID. For each server, you should pick a unique positive integer in the range from 1 to 232 – 1, and each ID must be different from every other ID. Example: server-id=3

Options that you can use on the master server for controlling binary logging are described in Section 5.11.3, “The Binary Log”.

Some slave server replication options are handled in a special way, in the sense that each is ignored if a file exists when the slave starts and contains a value for the option. The following options are handled this way:

The file format in MySQL 5.0 includes values corresponding to the SSL options. In addition, the file format includes as its first line the number of lines in the file. (See Section 6.3.5, “Replication Relay and Status Files”.) If you upgrade an older server (before MySQL 4.1.1) to a newer version, the new server upgrades the file to the new format automatically when it starts. However, if you downgrade a newer server to an older version, you should remove the first line manually before starting the older server for the first time.

If no file exists when the slave server starts, it uses the values for those options that are specified in option files or on the command line. This occurs when you start the server as a replication slave for the very first time, or when you have run RESET SLAVE and then have shut down and restarted the slave.

If the file exists when the slave server starts, the server uses its contents and ignores any options that correspond to the values listed in the file. Thus, if you start the slave server with different values of the startup options that correspond to values in the file, the different values have no effect, because the server continues to use the file. To use different values, you must either restart after removing the file or (preferably) use the CHANGE MASTER TO statement to reset the values while the slave is running.

Suppose that you specify this option in your my.cnf file:


The first time you start the server as a replication slave, it reads and uses that option from the my.cnf file. The server then records the value in the file. The next time you start the server, it reads the master host value from the file only and ignores the value in the option file. If you modify the my.cnf file to specify a different master host of some_other_host, the change still has no effect. You should use CHANGE MASTER TO instead.

MySQL Enterprise.  For expert advice regarding slave startup options subscribe to the MySQL Network Monitoring and Advisory Service. For more information see

Because the server gives an existing file precedence over the startup options just described, you might prefer not to use startup options for these values at all, and instead specify them by using the CHANGE MASTER TO statement. See Section, “CHANGE MASTER TO Syntax”.

This example shows a more extensive use of startup options to configure a slave server:


The following list describes startup options for controlling replication. Many of these options can be reset while the server is running by using the CHANGE MASTER TO statement. Others, such as the --replicate-* options, can be set only when the slave server starts.


JavaScript Editor Source code editor     What Is Ajax