Can't Connect to MySQL instance Remotely that is running on EC2 Instance (Not RDS)

不打扰是莪最后的温柔 提交于 2019-12-11 14:58:23

问题


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.

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

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

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.

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

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.

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


回答1:


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).

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.



来源:https://stackoverflow.com/questions/22966942/cant-connect-to-mysql-instance-remotely-that-is-running-on-ec2-instance-not-rd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!