问题描述
我想建立一个访问MySQL数据库在AWS上我的本地机器一个开发环境,但我不断收到一个无法连接的消息。
I am trying to set up a dev environment on my local machine that accesses a MySQL DB on AWS, but I keep getting a "Can't connect" message.
mysql_connect('xxx.xxx.xxx.xxx:3306', 'USERNAME', 'PASSWORD');
我也注释掉绑定地址在my.cnf文件,并授予权限所连接的IP地址。
I also commented out the bind-address in the my.cnf file, and granted permissions to the IP address that is connecting.
有谁成功地得到这个工作?
Anyone ever successfully get this working?
推荐答案
我想这是亚马逊的防火墙,请尝试使用SSH隧道:
I suppose this is firewalled by Amazon, try using a SSH tunnel:
http://blogs.oracle.com/divyen/entry/connecting_mysql_server_on_amazon
注:使用IP过滤即使是在不打开MySQL的公共互联网。 SSH隧道是方式更安全。它的最好的部分:隧道可能是与本地主机访问:3306你的机器上,无需更改配置:)
Note: Do not open MySQL to the public internet, not even when using IP filtering. SSH tunnels are way more secure. Best part of it: The tunnel could be accessible with localhost:3306 on your machine, no need to change the config : )
这篇关于从本地机器连接到MySQL在AWS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!