如何从远程计算机(不是本地主机)访问 MySQL?

2023-10-26数据库问题
11

本文介绍了如何从远程计算机(不是本地主机)访问 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

Mysql目录里的ibtmp1文件过大造成磁盘占满的解决办法
ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致...
2025-01-02 数据库问题
151

SQL 子句“GROUP BY 1"是什么意思?意思是?
What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)...
2024-04-16 数据库问题
62

MySQL groupwise MAX() 返回意外结果
MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)...
2024-04-16 数据库问题
13

MySQL SELECT 按组最频繁
MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)...
2024-04-16 数据库问题
16

为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同
Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)...
2024-04-16 数据库问题
13

MySQL GROUP BY DateTime +/- 3 秒
MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)...
2024-04-16 数据库问题
14