content_image/777250.jpg content_image/777251.jpg
account can be used for this operation, providing it has been granted the REPLICATION SLAVE  privilege. You can choose to create a different account for each replica, or connect to the source using the same account for each replica. 

Although you do not have to create an account specifically for replication, you should be aware that the replication user name and password are stored in plain text in the replica’s connection metadata repository mysql.slave_master_info  (see Section 17.2.4.2, “Replication Metadata Repositories” ). Therefore, you may want to create a separate account that has privileges only for the replication process, to minimize the possibility of compromise to other accounts. 

To create a new account, use CREATE USER . To grant this account the privileges required for replication, use the GRANT  statement. If you create an account solely for the purposes of replication, that account needs only the REPLICATION SLAVE  privilege. For example, to set up a new user, repl , that can connect for replication from any host within the example.com  domain, issue these statements on the source: 

mysql> CREATE USER ’repl’@’%.example.com’ IDENTIFIED BY ’ password ’; mysql> GRANT REPLICATION SLAVE ON *.* TO ’repl’@’%.example.com’; 

See Section 13.7.1, “Account Management Statements” , for more information on statements for manipulation of user accounts. 

<img src='content_image/777250.jpg'>

## Important 

To connect to the source using a user account that authenticates with the caching_sha2_password  plugin, you must either set up a secure connection as described in Section 17.3.1, “Setting Up Replication to Use Encrypted Connections” , or enable the unencrypted connection to support password exchange using an RSA key pair. The caching_sha2_password  authentication plugin is the default for new users created from MySQL 8.0 (for details, see Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication” ). If the user account that you create or use for replication (as specified by the MASTER_USER  option) uses this authentication plugin, and you are not using a secure connection, you must enable RSA key pair-based password exchange for a successful connection. 

## 17.1.2.4 Obtaining the Replication Source Binary Log Coordinates 

To configure the replica to start the replication process at the correct point, you need to note the source’s current coordinates within its binary log. 

<img src='content_image/777251.jpg'>

## Warning 

This procedure uses FLUSH TABLES WITH READ LOCK , which blocks COMMIT operations for InnoDB  tables. 

If you are planning to shut down the source to create a data snapshot, you can optionally skip this procedure and instead store a copy of the binary log index file along with the data snapshot. In that situation, the source creates a new binary log file on restart. The source binary log coordinates where the replica must start the replication process are therefore the start of that new file, which is the next binary log file on the source following after the files that are listed in the copied binary log index file. 

To obtain the source binary log coordinates, follow these steps: 

1. Start a session on the source by connecting to it with the command-line client, and flush all tables and block write statements by executing the FLUSH TABLES WITH READ LOCK  statement: 

mysql> FLUSH TABLES WITH READ LOCK; 

