远程MYSQL数据库访问 [英] Remote MYSQL Database Access
问题描述
我在java中开发了一个访问远程mysql数据库的应用程序。当我运行它的系统的netbeans IDE运行该wamp服务器。但是当我尝试通过netbeans将另一个系统连接到远程系统数据库时,它显示以下错误。
I have developed an application in java that access remote mysql database. While I am running it by netbeans IDE of system which have running that wamp server. But while i try I make connection in another system to remote system database by netbeans it shows following error.
无法添加连接,无法建立与jdbc的连接:mysql: //192.168.1.14:3306/test using(CommunicationsException:Communications link failure
Unable to add connection, Cannot establish a connection to jdbc:mysql://192.168.1.14:3306/test using(CommunicationsException: Communications link failure
发送到服务器的最后一个数据包是0 ms前。
Last packet sent to the server was 0 ms ago.
请帮助我。
提前致谢
推荐答案
你有ssh访问服务器吗?我会用ssh,plink或putty运行隧道(ssh -L 3305:127.0.0.1:3306 192.168.1.14),然后使用这个连接url
Do you have ssh access to the server? I would have run a tunnel with ssh, plink or putty (ssh -L 3305:127.0.0.1:3306 192.168.1.14) and then use this connection url
jdbc:mysql://127.0.0.1:3305/test
如果我们知道您的操作系统,那么协助会更容易。
It would be easier to assist if we'd known your operating system.
如果这是部署情况从你的IP地址打开端口3306的防火墙可能是正确的。在linux中你可能会在/ etc / sysconfig中找到设置/ iptables,但您的系统管理员可能有其他安全防护。您还必须验证mysql实际上是在侦听IP地址,而不仅仅是localhost。
If this is a deployment situation, opening the firewall for port 3306 from your IP address is probably the right thing. In linux you might find the settings in /etc/sysconfig/iptables, but your sysadmin may have other safe guards in place. You must also verify that mysql is actually listening on the IP-address, and not only localhost.
这篇关于远程MYSQL数据库访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!