Let's pretend that
SERVER1 (192.168.0.100) SERVER2 (192.168.0.200)
If you are replicating, then SERVER1 will need to have access to MySQL on SERVER2 (and possibly vice versa if SERVER2 needs access to SERVER1). To do this, you need a USER who is allowed access from another server, i.e.
-- User on SERVER1 that SERVER2 would use to repllicate CREATE USER 'repl'@'192.168.0.200' IDENTIFIED BY 'slavepass'; -- User on SERVER2 that SERVER1 would use to repllicate CREATE USER 'rep2'@'192.168.0.100' IDENTIFIED BY 'slavepass';
For ease of use, you can later apply them to the domain name, i.e.
SERVER1 (192.168.0.100) server1.mydomain.com SERVER2 (192.168.0.200) server2.mydomain.com
And then for the sake of consistency, you can simply have the next user on both SERVER1 and SERVER2
-- User on SERVER1 that SERVER2 would use to repllicate CREATE USER 'rep'@'%.mydomain.com' IDENTIFIED BY 'slavepass'; -- User on SERVER2 that SERVER1 would use to repllicate CREATE USER 'rep'@'%.mydomain.com' IDENTIFIED BY 'slavepass';
The domain does not even have to be real if physical servers can resolve them, i.e. you can add the following to host files.
-- On SERVER1 add the following into /etc/hosts server2.mydomain.com 192.168.0.200 -- On SERVER2 add the following into /etc/hosts server1.mydomain.com 192.168.0.100
If your server is Windows based, you will probably find hosts in C:\Windows\system32\drivers\etc\hosts
source share