I'm setting up a MySQL slave, but it can't connect to master (error 2003). Master is available. I suspect that MySQL resolves Master's hostname to some unexpected IP address and consequently chooses different route which is not allowed to connect to the master. Both master and slave are RDS MySQL in different VPCs :)

So how can I figure out what IP address MySQL gets using only MySQL commands or logs?

  • traceroute or tracert
    – Rick James
    Apr 10 '17 at 17:08
  • RDS :) I have no shell
    – user60433
    Apr 10 '17 at 17:23
  • You could set up a ec2 instance in the slave's VPC and ping the hostname for the master. Are you sure your VPC security groups are configured appropriately to allow 3306 traffic between the VPCs? Apr 10 '17 at 18:11
  • I checked from an EC2 instance in the same (slave) VPC, and the master is available (as I mentioned in my post). I know that RDS replicas connect to master via some very internal network that does not belong to one's VPC. That's why I suspect that DNS resolving may differ as well.
    – user60433
    Apr 10 '17 at 18:16

Alright.. It was wrong TCP port. Sorry :) So I solved my problem with RDS connectivity. But the second part still stands: MySQL server as a "DNS resolver". While dealing with RDS I tried to go with PostgreSQL, because if it were DNS problem it would affect PostgreSQL as well. I figured that I can do it in PostgreSQL with various extensions like plperlu. Unfortunately, all of them are blocked in RDS :)


Would recommend not using DNS and just using the IP address. You can disable it by starting with --skip-name-resolve though perhaps that is not an option on RDS.

Basically any time DNS plays up your slave is going to lag behind.

DNS can also prevent connections that authenticate using a hostname if the lookup fails. Much better to just use the IP.


Go to your both VPCs where the RDS is launched and enable DNS resolution.

  • It's enabled. And I hope that from my post it is clear that DNS resolution works. In fact, I'm asking if there are ways to use MySQL server as host or dig utility :) This is for CIA (kidding).
    – user60433
    Apr 11 '17 at 13:06
  • We need to check 3 things, 1.Are you able to telnet 2.enable VPC peering if not allow RDS in publically accessible? 3. Check security Group rules.
    – TheDataGuy
    Apr 11 '17 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy