disasterkid
disasterkid

Reputation: 7278

Unable to Connect to RDS MySQL database via Workbench

I have created a MySQL database using Amazon RDS with the following settings which is now in the available state.

Engine: MySQL 5.6.39

DB instance class: db.t2.micro

I did not chose the production version and went on with the dev version.

I have installed MySQL workbench (version 6.3 64x community) on my macOS.

I follow Amazon's own instructions on how to connect to the server.

But upon clicking on Test Connection, I get the following error.

enter image description here

Upvotes: 2

Views: 4201

Answers (2)

lmiguelvargasf
lmiguelvargasf

Reputation: 69705

I had a hard time trying to connect to an RDS using MYSQL Workbench. Assuming you have logged into AWS:

  1. Go to RDS -> Databases -> Select your database

enter image description here

  1. Make sure the Public Accessibility value is Yes enter image description here

  2. Check your IP address using http://checkip.amazonaws.com/. If it is not added to the Security Rule Groups, you should add it. this step is crucial

3.1. Click on the rule name. This will open up a new tab, then click in the name of the rule.

enter image description here

3.2. Click on Edit inbound rules

enter image description here

3.3. Click on Add new rule, and add a rule with the following values:

Type: MYSQL/Aurora.

Protocol: TCP (default)

Port range: 3306 (default)

Source: My IP -> This will be the IP Address you got at http://checkip.amazonaws.com/.

enter image description here

  1. Fill information in MySQL Workbench

enter image description here

Hostname: Use the value you have for Endpoint at Connectivity and Security

Port: Use the value you have for Port at Connectivity and Security, by default it is 3306.

Username: Use the value you have for master username at Configuration

Password: Use the value you set when you created the database instance.

If you forgot the password, you can change it by clicking on Modify in your database instance)

enter image description here enter image description here

Upvotes: 6

ThomasVdBerge
ThomasVdBerge

Reputation: 8140

The most common error is not having allowed yourself access/not set to public accessibility.

  1. Ensure that the RDS DB instance was marked as publicly accessible (change to YES.

Select Yes if you want EC2 instances and devices outside of the VPC hosting the DB instance to connect to the DB instance. If you select No, Amazon RDS will not assign a public IP address to the DB instance, and no EC2 instance or devices outside of the VPC will be able to connect. If you select Yes, you must also select one or more VPC security groups that specify which EC2 instances and devices can connect to the DB instance.

  1. Make sure you've allowed yourself access in the Security Group of the RDS database. You should add a rule that allows your ip (or 0.0.0.0/0) to access the RDS on port 3306.

Upvotes: 7

Related Questions