本文介绍了无法从AWS EC2连接到RDS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的AWS和我在遇到麻烦连接到我的RDS实例,从我的EC2实例。我认为无论是坐在同一个VPC内。我可以用SSH2从腻子连接到我的EC2实例,我可以使用Eclipse连接到我的RDS实例。不过,我看不到连接到从EC2的RDS。当我尝试下面的命令:

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命令提示符>的mysql -h端点-P 3306 -u用户-p密码

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

我收到以下错误:

输入密码:

ERROR 1049(42000):未知数据库密码

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.

任何帮助将是AP preciated - !谢谢

Any help would be appreciated - thanks!

推荐答案

好了 - 我能弄清楚什么是错的。看来我应该使用下面的连接到RDS:

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用户名-p -h端点DATABASENAME

mysql -u username -p -h endpoint databaseName

这促使我在我的密码,然后我连接到我的数据库上面,我已经设置了RDS实例进入。显然,你必须指定要连接到数据库,端口号是可选的。我能都与它没有它连接。我读过关于AWS的文档从未实际上有数据库名,这是被扔我。希望这可以帮助别人。

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.

这篇关于无法从AWS EC2连接到RDS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 15:46