Documentation Home
MySQL Replication
Related Documentation Download this Excerpt
PDF (US Ltr) - 1.4Mb
PDF (A4) - 1.4Mb
HTML Download (TGZ) - 366.2Kb
HTML Download (Zip) - 380.6Kb Setting the Replication Slave Configuration

Each replication slave must have a unique server ID, as specified by the server_id system variable. If you are setting up multiple slaves, each one must have a unique server_id value that differs from that of the master and from any of the other slaves. If the slave's server ID is not already set, or the current value conflicts with the value that you have chosen for the master server or another slave, you must change it. With the default server_id value of 0, a slave refuses to connect to a master.

You can change the server_id value dynamically by issuing a statement like this:

SET GLOBAL server_id = 21;

If the default server_id value of 0 was set previously, you must restart the server to initialize the replication slave with your new nonzero server ID. Otherwise, a server restart is not needed when you change the server ID, unless you make other configuration changes that require it. For example, if binary logging was disabled on the server and you want it enabled for your slave, a server restart is required to enable this.

If you are shutting down the slave server, you can edit the [mysqld] section of the configuration file to specify a unique server ID. For example:


A slave is not required to have binary logging enabled for replication to take place. However, binary logging on a slave means that the slave's binary log can be used for data backups and crash recovery. Slaves that have binary logging enabled can also be used as part of a more complex replication topology. If you want to enable binary logging on a replication slave, use the log-bin option in the [mysqld] section of the configuration file. A server restart is required to start binary logging on a server that did not previously use it.