I have just created an AWS EC2 Ubuntu instance and an RDS mariadb instance to go with it. (I'm using the free tier at the moment).

I have turned off the public access to the RDS so that it only is accessible within the same VCS. My EC2 box is in the same the VCS and I want to connect to the database from there.

I installed mariadb-client on my Ubuntu box. I used the endpoint from my RDS Instance page for the RDS box and ran the command:

mysql  -P 3306 -u thomas -p -h ******.******.us-east-1.rds.amazonaws.com

ERROR 2005 (HY000): Unknown MySQL server host '******.*****.us-east-1.rds.amazonaws.com' (-2)

host ******.******.us-east-1.rds.amazonaws.com returns not found.

When I had mis-spelled the server name on my first attempt, I got a (-3) after the error, which I think is interesting. So I googled the error code and found this: https://dev.mysql.com/doc/refman/5.5/en/error-messages-client.html which tells me about the error code 2005, but nothing about the part in parens.

The docs refer to an include, which I looked up, but found no -2. So:

1) Where do you find the information about the info in parens?

2) Why can't I reach my RDS instance?

  • @RuiFRibeiro How do you find the IP address of a non-public server? I followed your link, but stil didn't see a -2 or -3.
    – Thom
    Oct 8, 2016 at 21:58
  • @RuiFRibeiro has provided bad information. The sqlstate here is HY000, "generic error." The number in parentheses at the end is the system error, which should not be a negative number. That's unusual. If it were a positive number, perror <number> would work. Oct 8, 2016 at 22:30
  • You can get the IP address with the host command, e.g. host example.com. Oct 8, 2016 at 22:31
  • @Michael-sqlbot added results of host command.
    – Thom
    Oct 8, 2016 at 23:37
  • You probably need to double-check that hostname in the RDS console. Oct 9, 2016 at 0:14

2 Answers 2


Well, as would be expected, I was a knucklehead. First, I didn't realize this, but the endpoint changed for some reason. I probably changed a setting and it rebuilt it without me asking and gave it a new endpoint name. This is why the nslookup and host commands were failing.

Then, once they starting working, I was going to work on the script I was using to connect and I realized I had left the :3306 at the end of the hostname on the -h parameter. I deleted this and everything started working.

This is what happens when you vote "No" for lobotomies for web developers.


I would suggest trying the IP address of RDS instance instead of the host name. See if you can access the port directly, without the client package ie. telnet host 3306.

Also, since they are in the VPC, make sure the subnets match. That has gotten me before with multiple internal subnets.

  • How do you get the IP address of something not accessible from outside? I don't see IP addess in the info.
    – Thom
    Oct 8, 2016 at 21:58
  • You should probably take a look at this (if you have not already), docs.aws.amazon.com/AmazonRDS/latest/UserGuide/… Make sure the VPC subnets and security groups allow access, and you should be able to find the subnet group, and thus the internal instance IP from there.
    – Protocol96
    Oct 8, 2016 at 22:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .