Page 1 of 1

How to access MySQL server running on MacOS host

Posted: 16. Jun 2017, 02:45
by Justin12
Host: MacOS 10.12 running MySQl server
Guest: Ubuntu 16.0.4 LTS

Problem: From Ubuntu as Guest, I cannot access my MySQL server running on the iMac host.

I really have tried many options with various Virtualbox network cards and settings. From the guest, I can access the Internet but not my MySQL server on the host. I've tried many port forwarding options, but nothing seems to work.

Could someone perhaps give me a suggestion on how to set this up? A clear example would truly be appreciated. Thanks!!

Re: How to access MySQL server running on MacOS host

Posted: 16. Jun 2017, 08:18
by socratis
Here's a summary of the different network modes in VirtualBox:
[pre]+-----------+-------------+-------------+----------------+----------------+
| | VM <-> Host | VM1 <-> VM2 | VM -> Internet | VM <- Internet |
+-----------+-------------+-------------+----------------+----------------+
| HostOnly | Yes | Yes | No | No |
| Internal | No | Yes | No | No |
| Bridged | Yes | Yes | Yes | Yes |
| NAT | No | No | Yes | Port forward |
| NATService| No | Yes | Yes | Port forward |
+-----------+-------------+-------------+----------------+----------------+[/pre]

You need to use the HostOnly mode (which allows connections between the guest and the host ONLY), or the Bridged mode, which makes the VM just like another computer on your network. More information, ch. 6. Virtual networking. And remember, you can always have more than one network card in your guest to cover multiple scenarios.

Re: How to access MySQL server running on MacOS host

Posted: 16. Jun 2017, 19:35
by Justin12
Thank you very much Socratis! That chart was very helpful. I’m a happy VB’er now!!