A replication user is necessary to set up the relationship
Replica. This is a short step but it needs a bit more of attention.
From the MySQL 5.7 documentation (highlights are my own):
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 master info repository file or table (see Section 126.96.36.199, “Slave Status Logs”). 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.
The following command specifically will allow replication from all databases and tables connecting from all hosts. For security reasons you may want to limit access to replication only to the IP address of the server doing the replication.
Log into the MySQL console using a user with
GRANT privileges in the
primary server and execute the following:
CREATE USER 'replication'@'%' IDENTIFIED BY 'mysupersecretpassword'
GRANT REPLICATION SLAVE ON *.* TO 'replication'@'%';
My advice is instead of using the
% wildcard, set up the IP address of your
This user will be added to the
MASTER_USER option, and in theory could be any user as long it also has
REPLICATION SLAVE privileges. After that, the
replica will connect to the
primary and perform some kind of handshake with those credentials and if they match, the
primary will allow replication to occur.
See something wrong in this tutorial? Please don’t hesitate to message me through the comments or the contact page.