To set up the replica to communicate with the source for replication, configure the replica with the necessary connection information. To do this, execute the following statement on the replica, replacing the option values with the actual values relevant to your system:
mysql> CHANGE MASTER TO -> MASTER_HOST='source_host_name', -> MASTER_USER='replication_user_name', -> MASTER_PASSWORD='replication_password', -> MASTER_LOG_FILE='recorded_log_file_name', -> MASTER_LOG_POS=recorded_log_position;
Replication cannot use Unix socket files. You must be able to connect to the source MySQL server using TCP/IP.
CHANGE MASTER TO statement
has other options as well. For example, it is possible to set
up secure replication using SSL. For a full list of options,
and information about the maximum permissible length for the
string-valued options, see CHANGE MASTER TO Statement.
The next steps depend on whether you have existing data to import to the replica or not. See Section 2.2.4, “Choosing a Method for Data Snapshots” for more information. Choose one of the following:
If you do not have a snapshot of a database to import, see Section 188.8.131.52, “Setting Up Replication between a New Source and Replicas”.
If you have a snapshot of a database to import, see Section 184.108.40.206, “Setting Up Replication with Existing Data”.