0
votes

I'm new to AWS and I'm having trouble connecting to my RDS instance from my EC2 instance. I think both are sitting within the same VPC. I can use SSH2 from putty to connect to my EC2 instance and I can use eclipse to connect to my RDS instance. However, I can't see to connect to the RDS from the EC2. When I try the following command:

ec2 command prompt> mysql -h endpoint -P 3306 -u user -p password

I get the following error:

Enter password:

ERROR 1049 (42000): Unknown database 'password'

Any ideas what I'm doing wrong? Also, why is it asking me for my password again? I've already specified it in my connection string.

Any help would be appreciated - thanks!

1

1 Answers

4
votes

Okay - I was able to figure out what was wrong. It seems that I should be using the following to connect to the RDS:

mysql -u username -p -h endpoint databaseName

This prompts me to enter in my password, which then connects me to my database above in the RDS instance that I have set up. Evidently, you have to specify the database that you want to connect to and the port number is optional. I was able to connect both with it and without it. The documentation on AWS that I've read has never actually had the database name, which is what was throwing me off. Hope this can help someone else.