neutrino
neutrino

Reputation: 924

MySQL / AWS RDS : ERROR 2003 (HY000): Can't connect to MySQL server

I have the newest version of mysql installed , along with mysql workbench:

$ mysql --version
mysql  Ver 8.0.25-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))

When i try to run $ mysql -h pgdb6.cy6onqf2jyfs.us-east-2.rds.amazonaws.com -P 3306 -u admin, the process hangs for a while, and then kicks back the error :

ERROR 2003 (HY000): Can't connect to MySQL server on 'pgdb6.cy6onqf2jyfs.us-east-2.rds.amazonaws.com:3306' (110)

I cant connect to the mysql server on aws. I have changed my mysql password. I have uninstalled and reinstalled mysql a few times. Im not sure what im missing!

Here is my setup on aws:

enter image description here

here are my security groups and inbound rules

enter image description here

Upvotes: 0

Views: 1698

Answers (2)

s.Aulakh
s.Aulakh

Reputation: 175

After editing security Groups rules as mentioned by all the answers, In my case I was still getting same issue. So I solved it by modifying the DB settings to make "Publicly accessible" setting to "Yes" as it was set to "No" in my case.

enter image description here

Here's how to do that:

  1. Go to the AWS RDS Dashboard and click on "Databases" to see a list of your RDS instances.
  2. Click on the RDS instance you're trying to connect to.
  3. Click on "Modify" in the top menu of the RDS instance details page.
  4. Scroll down to the "Connectivity" section, and find the "Public accessibility" option.
  5. Change "Public accessibility" to "Yes".
  6. Scroll down and click on "Continue", then review your changes. After reviewing, click on "Modify DB Instance" to apply the changes.

Upvotes: 0

Nikhil Gangadharappa
Nikhil Gangadharappa

Reputation: 36

I had the same issue and I'm fairly new to AWS. After a lot of research, found out that adding a new inbound rule for the security group worked. Below are the steps,

  1. Select the running EC2 instance.
  2. Navigate to security Groups and then to inbound rules.
  3. Edit Inbound Group.
  4. Add Rule.
  5. Under Type, Select "MYSQL/Aurora", Protocol : "All", Port range "All", Source "Custom", then add "0.0.0.0/0" and save rule.
  6. Do the same for the outbound rule.

Go back to terminal or just connect through AWS Console. This worked for me.

Upvotes: 2

Related Questions