Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have VirtualBox running Ubuntu on my Windows 7 computer.

Is it possible for me to connect to the MySQL server running on the VM from my Windows 7 host?

share|improve this question

migrated from Jul 28 '10 at 21:05

This question came from our site for professional and enthusiast programmers.

You can enable NAT on the virtual machine so that it's IP address is available on windows.

Another option is to enable port forwarding on the "Guest" machine, so that it is accessible on the "Host" machine as, this way you can just connect to localhost:3306.

I would suggest not doing option #2 if you are into having mysql on both your host and the guest.

share|improve this answer

If you give the virtual machine its own IP address - check out :

The virtual machine may be fully integrated into the network and you may have access between all virtual machine and the host if you do a little bit more.

A bridge can contain only one physical/virtual device. So you can create your bridge as follow:

# set PATH for the case we are called via sudo or su root


# create a tap
tunctl -t tap1 -u <user>
ip link set up dev tap1
# create the bridge
brctl addbr br0
brctl addif br0 tap1

# set the IP address and routing
ip link set up dev br0
ip addr add dev br0
ip route add dev br0

With this code you will be able to contact the virtual machine attached to the Host Interface tap1 from the host and the host from the virtual machine. The IP adress should not conflict with the main IP address of your PC which will probably been within the range

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.