如何从远程计算机(不是本地主机)访问 MySQL? [英] How to access MySQL from a remote computer (not localhost)?

查看:35
本文介绍了如何从远程计算机(不是本地主机)访问 MySQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 vmware 中将我的开发环境设置为 Ubuntu 服务器(安装 LAMP).vmware 在我的本地 Windows 7 机器上运行.当我尝试通过 HeidiSQL 程序访问我的 mysql 服务器时,连接失败.我得到一个:

I have my dev environment set up as a Ubuntu Server (with LAMP installation) inside a vmware. The vmware is running on my local windows 7 machine. When I try to access my mysql server via HeidiSQL program the connection fails. I get a:

Server Error 2003, can't connect to mysql server on <IP ADRESS HERE>

但是我可以通过 PhpMyAdmin 访问数据库服务器.MySQL 正在运行,我的连接凭据和端口都正确.

I can however access the db server via PhpMyAdmin. MySQL is running and my connection credentials and port are all correct.

我了解到您应该在 my.cnf 文件中输入您尝试连接的计算机的 IP 作为绑定地址".我做的.我尝试了内部网络IP以及在线IP.仍然没有运气,同样的消息.

I read that you should enter the IPs of the computer you are trying to connect from as the "bind address" in the my.cnf file. Which I did. I tried both the internal network IP as well as the online IP. Still no luck, same message.

由于这不是生产环境,我希望允许任何人访问该服务器,而不是通过 IP 对其进行限制.特别是因为我的 ISP 分配了动态 IPS.所以我必须一直改变它,假设它甚至有效.

Since this isn't a production environment I would ideally like to allow anyone to access that server, not limit it by IP. Especially since my ISP assigns dynamic IPS. So I would have to change it all the time, assuming that even works.

那么有谁知道我如何从远程计算机连接到我的 MySQL 服务器?

So does anyone know how I can connect to my MySQL server from a remote computer?

附言我认为这是开发人员必须处理的事情,这就是我将其发布在这里而不是超级用户的原因.如果必须迁移,请发送给Server Fault,而不是超级用户.

P.S. I assume this is something developers have to deal with that's why I posted it here and not Super User. If it must be migrated please send it to Server Fault not Super User.

推荐答案

对于 Heidi SQL,我能够按照本文中的说明使其工作:

For Heidi SQL I was able to get it to work following the instructions on this article:

http://mysql-tools.com/en/articles/http-tunnel/73-heidisql-a-http-tunnel.html

它使用一个名为 HTTP 隧道的程序.它要慢得多,但至少它有效.如果您使用 Navicat,它会附带一个 PHP 文件,您可以将其上传到您的服务器,然后它会通过该文件进行连接.

It uses a program called HTTP Tunnel. It's a lot slower but at least it works. If you use Navicat it comes with a PHP file that you can upload to your server and it will connect via that.

这篇关于如何从远程计算机(不是本地主机)访问 MySQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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