C1W2,Lab1 - Unable to connect to Mysql endpoint

When I connect to the mysql endpoint, I got the error:ERROR 2002 (HY000): Can’t connect to MySQL server on ‘de-c1w2-rds.c38cu6sc4d5b.us-east-1.rds.amazonaws.com’ (115). Could anyone shed some light on it?

Here are my shell commands and output.
voclabs:~/environment aws rds describe-db-instances --db-instance-identifier de-c1w2-rds --output text --query "DBInstances[].Endpoint.Address" de-c1w2-rds.c38cu6sc4d5b.us-east-1.rds.amazonaws.com voclabs:~/environment mysql --host=de-c1w2-rds.c38cu6sc4d5b.us-east-1.rds.amazonaws.com --user=admin --password=adminpwrd --port=3306
ERROR 2002 (HY000): Can’t connect to MySQL server on ‘de-c1w2-rds.c38cu6sc4d5b.us-east-1.rds.amazonaws.com’ (115)

Hello @toliu
I tried the lab, and the command is working fine on my side. These are the things that come to my mind that you can try:

  1. Please, make sure that you have run the command source scripts/setup.sh before going through the C1_W2_Assignment.md file.
  2. Make sure you are choosing the correct subnet for your Cloud9 environment. Choosing a wrong subnet always lead to connection issues since endpoints in different subnets are not able to communicate with each other.
  3. In the AWS console, search for RDS and open the RDS panel. From the menu on the left, choose Databases. There you should see the MySQL database and its status. Please, confirm that it is working like the screenshot below. The status should be Available.

Hello thanks for the information, I have the problem with the endpoint, I follow your steps but I still get the message in the terminal “no such file or directory” I am trying to do the step 2.1 and 2.2

Thank you, Amir. It works this time for me!

Hi @Gibloms,

In step 2.1, did you replace <MySQL-DB-name> with de-c1w2-rds? Perhaps you can share a screenshot of the line of code you ran in step 2.1 so we can help troubleshoot?

Jess

1 Like

Hi guys.

I deleted and created the instance again, but now it was stuck

It doesn’t do anything

Hi Toliu.

Did you complete it finally?

Hi @LuiferG_AI , I can see from your screenshot that you are trying to run the right command. Would you be able to double check that you used the specified configurations when setting up your Cloud9 environment? Let me know if you still run into this issue.

Hi @jessica-dlai. I have the same problem as @LuiferG_AI and @Gibloms.

I receive the following message in the terminal “no such file or directory”.

Additionally I have the following message in the AWS Console.

Thank you in advance for your support.

Eduardo Islas

Hi @LuiferG_AI and @EduardoIslas
I couldn’t reproduce the problem. My best guess is that in your cases the problem is with the subnet you have chosen for your Cloud9 environment. Please, make sure that you choose de-c1w2-public-subnet when creating the Cloud9 environment.

2 Likes

Hi Jessica.

Finally I could do it this way. Thanks.

aws rds describe-db-instances --query “DBInstances[?DBInstanceIdentifier==‘de-c1w2-rds’].Endpoint.Address” --output text

Hi Eduardo.

Did you complete it? Check my reply to Jessica.

I have the same issue (bash: de-c1w2-rds: No such file or directory) and the solution that worked for LuiferG_AI does not work for me. I get another error: Bad value for --query “DBInstances[?DBInstanceIdentifier==‘de-c1w2-rds’].Endpoint.Address”: Bad jmespath expression: Unknown token “:
“DBInstances[?DBInstanceIdentifier==‘de-c1w2-rds’].Endpoint.Address”
^

I even got the end point directly from the database, but still got the error on the next step.
The error says: voclabs:~/environment $ mysql --host=<de-c1w2-rds.cz4oequcsyqj.us-east-1.rds.amazonaws.com> --user= --password= --port=3306
bash: de-c1w2-rds.cz4oequcsyqj.us-east-1.rds.amazonaws.com: No such file or directory
Would it be because the database is not publicly available?

Dear @LuiferG_AI

Yes I can solve my problem. Than.k you very much for your support

Hi @LuiferG_AI, it’s very interesting that you were able to get the database host using the command:
aws rds describe-db-instances --query “DBInstances[?DBInstanceIdentifier==‘de-c1w2-rds’].Endpoint.Address” --output text
I just tried the lab and that didn’t work for me, but the original command outlined in the lab instructions did work. I’ll let the engineering team know about this just so that they are aware. I’m glad you were able to complete the lab with this workaround!

Hi @EduardoIslas , for each labs, we only give learners the access they need to complete the lab. So don’t worry about the access denied message on the AWS management console home page, you will see similar messages in other labs as well.

I’m glad that you were able to complete the lab :slight_smile:

Hi @Samuel_Andaluz , I got the same error as you when I tried to run the “work-around” command. However, I can confirm that the command from the assignment instructions worked for me.

As you can see from section 3 of the assignment instructions, the RDS database is hosted in a private subnet. So we need to ensure that we are set up in the same VPC in order to access this database.

Would you be able to double check your cloud9 configurations to ensure that you have selected the correct VPC and corresponding public subnet****?

Also, after creating the cloud9 environment and downloading the required files, don’t forget to complete step 7 from the Vocareum instructions:

I hope this helps!

Hi

I am still unable to connect to the mysql database

I have followed the instructions until being able to successfully install Terraform with this:
source scripts/setup.sh

After that I enter this and nothing comes up
mysql --host=de-c1w2-rds.chgmeomycz2r.us-east-1.rds.amazonaws.com --user=admin --password=adminpwrd --port=3306

And i get this error:
ERROR 2002 (HY000): Can’t connect to MySQL server on ‘de-c1w2-rds.chgmeomycz2r.us-east-1.rds.amazonaws.com’ (115)

Please help!

I managed to resolve my issue. Thank you!

1 Like