如何在VMware中访问Ubuntu上的远程mysql主机?
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有同样的问题,但你只需将你使用的用户设置为允许从任何主机访问,最简单的是在权限下从 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.