Given two mySql instances we'll call them host1.mydomain.com and host2.mydomain.com and we presume they are using the standard port 3306 to communicate, that you have a super mysql user we'll call root with password rootpw (name and password of course could be different), and that you can ssh to the hosts. (Sorry but Windows is not my forte however the commands below should be very similar.)
Commands are in bold.
begin by checking on access on host1.mydomain.com and access from host1.mydomain.com to host 2.mydomain.com
- ssh host1.mydomain.com
- telnet host2.mydomain.com 3306 You should get something like "connected". Then ctrl+v and quit If it hangs then get someone on your network team to help you figure out why you cannot reach the other host. In my experience this is 75% of the issues setting up replication.
- which mysql (is the mysql client binary in your path?) if not fix your path or in any mysql command specify the fully qualified location, something like /usr/bin/mysql
- login to mysql thusly mysql -h host1.mydomain.com -u root -p you will be prompted for the password
- record your server id. show global variables like 'server_id';
- make sure you have binary logging as show binary logs; If it says you are not using binary logging then add log-bin to your /etc/my.cnf file and bounce mysql.
- exit from this instance exit;
- try to reach host2 from host1.mydomain.com using the mysql client as mysql -h host2.mydomain.com -u root -p you will be prompted for the password. If this fails figure out why you cannot login. Is it a user or password issue? Are you sure the ports are open between the two hosts? Is the root user not allowed to do remote logins in which case you may need another super user (select user from mysql.user where user='root'; and there should be a wildcard for host1 and host2 should be in the host name field)
now check on access on host2 and access to host1 from host2
- ssh host2.mydomain.com
- telnet host1.mydomain.com 3306 You should get something like "connected". Then ctrl+v and quit If it hangs then get someone on your network team to help you figure out why you cannot reach the other host. In my experience this is 75% of the issues setting up replication.
- which mysql (is the mysql client binary in your path?) if not fix your path or in any mysql command specify the fully qualified location, something like /usr/bin/mysql
- login to mysql thusly mysql -h host2.mydomain.com -u root -p you will be prompted for the password
- record your server id. show global variables like 'server_id';
- make sure you have binary logging as show binary logs; If it says you are not using binary logging then add log-bin to your /etc/my.cnf file and bounce mysql.
- exit from this instance exit;
- try to reach host1.mydomain.com from host2.mydomain.com using the mysql client as mysql -h host1.mydomain.com -u root -p you will be prompted for the password. If this fails figure out why you cannot login. Is it a user or password issue? Are you sure the ports are open between the two hosts? Is the root user not allowed to do remote logins in which case you may need another super user (select user from mysql.user where user='root'; and there should be a wildcard for host1 and host2 should be in the host name field)