I currently have got 2 servers running mysql 5.1. Im settings them up as a master slave. Both have a static ip address and are not part of any domain. (currently they are in a vmware LAN)
The question is as in the mysql documentation it states that u have to setup a domain user for the replication although i dont have a domain.
How will i be able to setup a user so i can let the 2 servers replicate? This is the original line from the documentation:
CREATE USER 'repl'@'%.mydomain.com' IDENTIFIED BY 'slavepass';
Assume the following
SERVER1 (192.168.0.100)
SERVER2 (192.168.0.200)
If you are replicating, then SERVER1 will need to be able to access MySQL on SERVER2 (and potentially vica versa, if SERVER2 needs access to SERVER1). To do this you will need a USER that is permitted to access from the other 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 purposes of ease of use, you may wish to later on map these to a domain name, i.e.
SERVER1 (192.168.0.100) server1.mydomain.com
SERVER2 (192.168.0.200) server2.mydomain.com
And then for sake of consistency you could just have the following 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 doesn't even need to be real, as long as the physical servers are able to resolve them, i.e. you could add the following into the hosts 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'll probably find hosts at C:\Windows\system32\drivers\etc\hosts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With