access mysql in host from guest virtualbox

2019-03-03 09:15发布

This is my scenario,

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.

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.

So any help is appreciated.

Thanks

1条回答
萌系小妹纸
2楼-- · 2019-03-03 10:05

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

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).

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).

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.

查看更多
登录 后发表回答