Sahidul Islam
Sahidul Islam

Reputation: 489

Unable to connect to MySQL AWS RDS instance from local MySQL

I have created an MySQL RDS instance with VPC. Now i am trying to connect to that RDS instance from my Ubuntu 12.04 machine using MySQL client by following code:

mysql -u uname -h test.c6tjb4nxvlri.us-west-2.rds.amazonaws.com -P 3306 -p

But i am getting this error:

ERROR 2003 (HY000): Can't connect to MySQL server on 'test.c6tjb4nxvlri.us-west-2.rds.amazonaws.com' (110)

I searched about this error and everywhere solution came out like

enter image description here

I tried everything but still same error occures. Any explanations?

Upvotes: 2

Views: 2946

Answers (3)

Edwin Lingson
Edwin Lingson

Reputation: 11

My problem was with the Subnet and this comment helped me to identify my subnet was private.

After the identification that it was private, converting it into a public one solved my problem and it helped me. I was banging my head on this problem for the full day!!!

Upvotes: 1

Kumaresh Babu N S
Kumaresh Babu N S

Reputation: 1708

  1. In On-premises MySQL Workbench, use TCP/IP SSH Tunneling option. Make sure you have EC2 instance endpoint and keypair file.
  2. In SSH endpoint - add your EC2 instance endpoint and for SSH password, browse your keypair. Rest of configurations for MySQL. Like MySQL's endpoint, username, password, port and schema name.
  3. Test your connection it will return success. If not, check RDS Security group. In Security group, you open MySQL port for all IP address. Try it! it will work. Once connection was success, all schema are visible in MySQL Workbench.
  4. RDS DB instance need not to be in public subnet and it is not best practice to do. Always keep RDS DB instance in private subnet and open traffic for EC2 instance.

When you use TCP/IP SSH Tunneling, request traffic will send through EC2 instance to RDS DB instance.

HTH.

Upvotes: 0

Sahidul Islam
Sahidul Islam

Reputation: 489

The problem was in subnet. Subnet that you created must be publicly accessible.

Upvotes: 2

Related Questions