Unable to connect MySQL Workbench to RDS instance
Asked Answered
D

10

13

Am following this tutorial http://thoughtsandideas.wordpress.com/2012/05/17/monitoring-and-managing-amazon-rds-databases-using-mysql-workbench/

I am not able to Test DB Connection while creating new server instance to connect to the RDS database. It says Bad_Authentication[allowed_types=public_key], i have a tried different .pem files and have done through a lot of forums. I have also allowed access to my IP in the DB SecurityGroups for RDS and the Security Groups for EC2.

Please help me out. Thanks.

Delineation answered 10/5, 2013 at 17:55 Comment(1)
RDS doesn't use a public key. Are you trying to connect via SSH?Accommodation
D
72

This worked for me. 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

I hope this also helps you.

Dareece answered 1/4, 2020 at 17:30 Comment(2)
Those screenshots were of great help! also, for future readers who'd like to change their public accessibility, read this answer's comments.Richia
The adding of my local IP was in fact crucial as this answer states. My confusion is, I would've thought an Inbound rule I already created for "all IP4", 0.0.0.0/0 should've been sufficient.Cement
D
6

In my scenario the problem was simple I had to enable 3306 port for MYSQL in the related Security group in RDS > db instance section. enter image description here

Degeneracy answered 23/12, 2021 at 7:57 Comment(1)
this is the solution that worked for me, thanks @ShujaathEda
I
2

I had the same issue. I think you need to enable inbound traffic to the VPC. Follow the below article and you'll be fine. Default VPC is not allowing users to access 3306 by default and you need to allow traffic.

RDS and MySQL Connectivity

enter image description here

Invisible answered 14/12, 2020 at 19:7 Comment(0)
M
2

Make sure Public accessibility should be yes.

Also, Inside security Group section, click on the security link and then add a new rule under inbound rule section which will whitelist your IP address with the below data :

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/.

Hope this will help to connect with AWS RDS successfully. Thanks!

Monaxial answered 22/5, 2021 at 10:40 Comment(0)
C
1

For RDS no need to use ssh. You can directly connect the RDS with MySql workbench. Follow the following steps-

Make sure that in Security Group you should have provide access for MYSQL

  1. Open MySQL workbench and setup New Connection.
  2. Provide a Connection Name.
  3. Connection Method is set to Standard (TCP/IP)
  4. In the HostName provide your RDS end point
  5. Port is 3306
  6. Enter the username what you have given in the RDS.
  7. Test Connection, and provide the password. That's it. For Reference GoTo This Link
Cauthen answered 30/1, 2015 at 8:59 Comment(0)
F
1

If you are not using EC2 Instance to connect with RDS DB Instance then DB Instance should have public access to connect.

  1. While launching DB Instance you need to set Publicly Accessible to yes. You will get Public IP to connect from outside network. That means outside of VPC.
  2. You need to launch DB Instance in Public Subnet which has directly access to Internet. To check Subnet has Internet access, you need to check Route Table which was attached with the subnet. In Route table, check Internet Gateway is attached to the subnet.
  3. You don't need to SSH into DB Instance. Though the option is not available also.
  4. In MySQL WorkBench, click on Setup New Connection.
  5. Give connection name. Choose Standard (TCP/IP) option. You are not trying to connect DB Instance over EC2 Instance so the option with SSH with not work out in this case. You have to provide MySQL hostname, username, password and port.
  6. To verify connection, click on Test Connection button.

If you want to use EC2 Instance and connect DB Instance over EC2 Instance, you have to use Standard (TCP/IP) over SSH option. Check the following link What would prevent me from connecting to a MySQL server on AWS RDS from an AWS EC2 VM?

Fanchet answered 18/1, 2017 at 5:2 Comment(3)
I'm having trouble connecting Workbench to RDS instance. How do you check if Internet Gateway is attached to the subnet. In the instance profile, the subnet group is marked as default. There are three subnets listed, and I click on one to inspect, but don't know how to check if theres Internet Gateway attached.Eupatrid
@ConnerM. There are two things we need to confirm it. We have to check an EC2 instance launched in public subnet or private subnet. Another one, we need to check the internet gateway is associated with the VPC or not.Fanchet
@ConnerM. Please get the subnet id of your EC2 instance. In VPC dashboard, get that subnet details using id and get its VPC id. Next, please go to internet gateway dashboard from VPC, copy/paste VPC id if it not available we have to associate with that VPC.Fanchet
K
0

Based on the details in your question, it seems that you are trying to SSH into the RDS instance. This is not supported on RDS, it only works for EC2 based MySQL servers.

You should instead connect directly to the MySQL server, on port 3306 (or the one you set manually, if this is the case) and using the username and password you created when provisioning the RDS instance. This means using the Connection Type "Standard TCP/IP" in WB.

Also, the public IP address of the machine you're using MySQL Workbench on should be allowed in the RDS security group.

Klimesh answered 8/10, 2013 at 12:26 Comment(0)
I
0

Even I had the same issue, like after trying all the things out there. A thing worked is modifying the RDS database and making it publically accessible. That sorted things out.

Inhabitancy answered 11/12, 2019 at 8:39 Comment(0)
S
0

All of the other answers are extremely helpful to debug the connection process but for me the literal fix was to not put in the password into the keychain when initializing the MySQL Connections. Instead, I pressed Test and put in the password when prompted to do so. Running on macOS Monterey V.12.3.1 with a MBP M1, 2020

Subshrub answered 23/9, 2022 at 21:19 Comment(0)
K
0

It was a nightmare for me until I realized that wifi could be an issue. Just try to connect the SQL workbench with a different WiFi or Internet.

Krongold answered 28/4, 2023 at 22:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.