从来宾virtualbox访问主机中的mysql [英] access mysql in host from guest virtualbox

查看:194
本文介绍了从来宾virtualbox访问主机中的mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的情况,

我在虚拟盒子中安装了Ubuntu 12.10主机和Win 7 guest虚拟机.在虚拟框中将网络配置为NAT.我在Ubuntu中安装了一个mysql服务器,其my.cnf中的"bind_address"已被注释掉.

I have a Ubuntu 12.10 host and a win 7 guest installed in the virtual box. The Network is configured to be NAT in the virtual box. I have a mysql sever installed in the Ubuntu with "bind_address" in my.cnf is commented out.

如何从Windows 7 guest虚拟机访问此mysql服务器?我在Google中进行了一些搜索,并遇到了主机-仅使用VirtualBox联网,但是我无法使用它,因为我的互联网供应商没有静态IP,并且我的网络知识非常差.我所知道的是,我已启用DHCP的Internet连接.因此,如果我在网络设置中使用了任何IP,那么我就没有Internet.

How can I access this mysql server from the windows 7 guest? I did some search in Google and came accross with this Host-Only Networking With VirtualBox but I cant get it work as I don't have statics IP with my internet vendor and my network knowledge is very bad. All I know is that I have DHCP enabled Internet connection. So if i do any IP's in the network settings I don't have Internet.

我知道在其他方面也有很多解决方案(从主机访问来宾服务器),但仍然无法解决.

I know that there are plenty of solutions on the other way around (access the guest server from the host) but still cant figure it out.

因此,感谢您的帮助.

谢谢

推荐答案

您的外部IP是否为静态IP与访问LAN上的虚拟服务器无关. 将VirtualBox设置为桥接模式.

Your external IP being static or not has no bearing to accessing a virtualized server on your LAN. Set VirtualBox to bridge mode.

只需确定计算机的DHCP选择的内部IP(通常为192.168.1.SOMETHING),然后将最后一个数字替换为小于250的另一个.例如,如果您的计算机为192.168.1.6,则192.168.1.70在计算机上可以正常工作VM(选择大量数字以消除冲突).

Simply determine your computer's DHCP-selected internal IP (usually 192.168.1.SOMETHING) and replace the last number with another that is less than 250. For example, if your computer was 192.168.1.6, 192.168.1.70 would work fine on the VM(pick a high number to void conflicts).

使用控制面板->适配器设置进行设置.重新启动VM.通过192.168.1.70(或您之前选择的地址)连接到MySQL.

Set it by using the control panel->adapter settings. Reboot the VM. Connect to MySQL at 192.168.1.70(or the address you picked earlier).

注意:如果您的计算机地址位于其他子网(192.168.0.XXX,10.XX.XX.XX等)中,请更改最后一个数字,并保持第一个数字与主机上的相同.

Note: If your computer's address is in a different subnet (192.168.0.XXX, 10.XX.XX.XX, etc) change the last number and keep the first numbers the same as on the host.

这篇关于从来宾virtualbox访问主机中的mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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