如何在VMware中访问Ubuntu上的远程mysql主机?

发布于 2024-10-10 06:49:07 字数 710 浏览 0 评论 0原文

我在 Mac OSX Snow Leopard 上的 VMware fusion 中运行 Ubuntu 10.10。在 ubuntu 中,我尝试使用命令行 mysql 连接到托管在单独的 Web 服务器上的数据库。由于某种原因,mysql 将远程主机名误解为本地地址,并且无法连接到数据库。

步骤:(来自 VMware 内的 ubuntu)

mysql -u <my-username> -h mysql-2.sandbox.wrkng.net -p

Enter Password: <my password>

预期:登录 mysql

得到:

ERROR 1045 (28000): Access denied for user '<my-username>'@'c-71-233-98-90.hds1.ma.comcast.net' (using password: YES)

请注意,错误消息中引用的主机名与我输入到 mysql 命令的主机名不同。

此外,从 Mac(VM 主机)终端执行相同的命令可成功连接到数据库。

我对 VMware 或 Linux 并不熟悉,所以我可能在这里遗漏了一些明显的东西——似乎 ubuntu 或 VM 中的某个地方存在网络问题。另请注意,通过虚拟机内的 ubuntu 访问互联网工作正常。

非常感谢任何帮助。谢谢!

I'm running Ubuntu 10.10 inside VMware fusion on Mac OSX Snow Leopard. Inside ubuntu, I'm attempting to use command-line mysql to connect to a database hosted on a separate web server. For some reason, mysql misinterprets the remote hostname as a local address, and is not able to connect to the database.

Steps: (from ubuntu inside VMware)

mysql -u <my-username> -h mysql-2.sandbox.wrkng.net -p

Enter Password: <my password>

expected: to log into mysql

got:

ERROR 1045 (28000): Access denied for user '<my-username>'@'c-71-233-98-90.hds1.ma.comcast.net' (using password: YES)

Note that the hostname referenced in the error message is different than the one I inputted to the mysql command.

Also, performing the same command from the Mac (host of the VM) terminal successfully connects to the database.

I am not seasoned with VMware or linux, so I may be missing something obvious here -- it seems like somewhere along the way either ubuntu or the VM has a networking issue. Note also that accessing the internet via ubuntu inside the VM works fine.

Any help is greatly appreciated. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流年已逝 2024-10-17 06:49:07

有同样的问题,但你只需将你使用的用户设置为允许从任何主机访问,最简单的是在权限下从 phpmyadmin 完成,

哦,你必须告诉 mysql 允许来自其他地方的连接:

编辑 /etc/mysql/ my.cnf

更改此行:bind-address = 127.0.0.1
至:#bind-address = 127.0.0.1
然后重新启动mysql:

sudo service mysql restart
它会起作用的。

had the same problem, but you just have to set the user you're using to be allowed from any host, easiest done from phpmyadmin under permssions,

oh and you have to tell mysql to allow connections from elsewhere:

edit /etc/mysql/my.cnf

change this line: bind-address = 127.0.0.1
to: #bind-address = 127.0.0.1
then restart mysql:

sudo service mysql restart
and it will work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文