Setting Up Binary Log File Position Based Replication 2. Shut down the existing replica: 3. Copy the data directory from the existing replica to the new replica, including the log files and relay log files. You can do this by creating an archive using  tar  or  WinZip , or by performing a direct copy using a tool such as  cp  or  rsync . A common problem that is encountered when adding new replicas is that the new replica fails with a series of warning and error messages like these: This situation can occur if the  relay_log  system variable is not specified, as the relay log files contain the host name as part of their file names. This is also true of the relay log index file if the relay_log_index  system variable is not used. For more information about these variables, see Section 17.1.6, “Replication and Binary Logging Options and Variables” . To avoid this problem, use the same value for  relay_log  on the new replica that was used on the existing replica. If this option was not set explicitly on the existing replica, use existing_replica_hostname -relay-bin . If this is not possible, copy the existing replica’s relay log index file to the new replica and set the  relay_log_index  system variable on the new replica to match what was used on the existing replica. If this option was not set explicitly on the existing replica, 071118 16:44:10 [Warning] Neither --relay-log nor --relay-log-index were used; so replication may break when this MySQL server acts as a replica and has his hostname changed!! Please use ’--relay-log= new_replica_hostname -relay-bin’ to avoid this problem. 071118 16:44:10 [ERROR] Failed to open the relay log ’./ old_replica_hostname -relay-bin.003525’ (relay_log_pos 22940879) 071118 16:44:10 [ERROR] Could not find target log during relay log initialization 071118 16:44:10 [ERROR] Failed to initialize the master info structure mysql>  STOP SLAVE; mysql>  SHOW SLAVE STATUS\G Or from MySQL 8.0.22: mysql>  STOP REPLICA; mysql>  SHOW REPLICA STATUS\G shell>  mysqladmin shutdown Important •Before copying, verify that all the files relating to the existing replica actually are stored in the data directory. For example, the  InnoDB  system tablespace, undo tablespace, and redo log might be stored in an alternative location. InnoDB  tablespace files and file-per-table tablespaces might have been created in other directories. The binary logs and relay logs for the replica might be in their own directories outside the data directory. Check through the system variables that are set for the existing replica and look for any alternative paths that have been specified. If you find any, copy these directories over as well. •During copying, if files have been used for the replication metadata repositories (see Section 17.2.4, “Relay Log and Replication Metadata Repositories” ), ensure that you also copy these files from the existing replica to the new replica. If tables have been used for the repositories, which is the default from MySQL 8.0, the tables are in the data directory. •After copying, delete the  auto.cnf  file from the copy of the data directory on the new replica, so that the new replica is started with a different generated server UUID. The server UUID must be unique. 3449