无法连接到MySQL实例远程正在对EC2实例(不RDS)运行 [英] Can't Connect to MySQL instance Remotely that is running on EC2 Instance (Not RDS)

查看:619
本文介绍了无法连接到MySQL实例远程正在对EC2实例(不RDS)运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看过很多帖子,声称他们正在运行MySQL的RDS实例中,他们无法连接到的,但我不RDS运行。

I have seen a lot of posts that claim they are running an RDS instance of MySql in which they cannot connect to, but I am not running RDS.

我用我的EC2 insance主办这是使用Web平台安装程序安装我的话,preSS博客。

I used my EC2 insance to host my wordpress blog which was installed using the Web Platform Installer.

该设置的话preSS架构,我需要的数据和我已经运行它几年。

This setup the wordpress schema and data that I needed and I have been running it for a couple years.

我只想登录到我的服务器,就能够访问这个数据库远程代替。

I want to be able to access this database remotely instead of only logging into my server.

我已经确认并具有以下用户

I have checked and have the following users

root
wpadmin

我还证实,在MySQL配置中指定的端口是标准的3306,我有一个设置入站防火墙规则来允许通过3306

I have also verified that the port specified in the mysql config is the standard 3306 and I have setup an Inbound Firewall rule to allow 3306 through.

当我尝试从MySQL Workbench的连接,我收到以下错误信息:

When I try to connect from MySql Workbench, I get the following error message:

3号是特别的一个,我不知道如何检查,但我确实知道,MySQL正在运行,并且它在3306上运行。另外,我知道我使用的是正确的密码。

Number 3 Is particularly one that I do not know how to check, but I do know that MySql is running and that it is running on 3306. Additionally, I know I am using the correct password.

当我尝试连接时,提示是这样的。我需要做一些事来授予的 Mysql的用户权限或什么?

When I try to connect, the prompt looks like this. Do I need to do something to grant Mysql user permissions or anything?

推荐答案

根据您的授权信息,你有用户只具有访问权限至少从问题本地主机。您将需要创建一个根@%用户(或多个特定的主机/ IP,而不是如果你有一个可靠的地址)。这将允许外部访问,只要你的EC2安全组还允许端口3306的访问(无论是在全球还是更严格的IP地址或IP地址范围)。

Based on your GRANT information, you have at least the problem of root user only having access privileges from localhost. You would need to create a root@% user (or a more specific host/IP instead of % if you have a reliable address). That would allow external access so long as your EC2 security group also allow access on port 3306 (either globally or to a more restrictive IP address or IP range).

当然,这里的安全含义是,你打开了访问MySQL,你可能不希望让更多的accessbile给潜在攻击者。出于这个原因,我建议你通过SSH隧道,这是支持MySQL的工作台访问你的数据库。这基本上让您外壳到宿主您的访问密钥,然后访问为根@本地

Of course the security implication here is that you are opening up access to MySQL that you might not want to make more accessbile to potential attackers. For this reason, I would recommend you access your DB via SSH tunnel, which is supported by MySQL workbench. This will in essence allow you to shell into the host your your access key and then access as root@localhost.

这篇关于无法连接到MySQL实例远程正在对EC2实例(不RDS)运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆