When you connect to 127.0.0.1
, you connect to the current system. Regardless of what system is running: main or vm
. You should configure network settings of the VirtualBox
so that vm
can connect to your main system. In this case you'll connect from vm
not to localhost but to IP-address that you set to main OS
.
Or you can setup MySQL
to the vm
and move your database to that MySQL
.
EDIT
For testing connection to MySQL
you can use telnet
(http://windows.microsoft.com/en-us/windows/telnet-faq#1TC=windows-7).
At first you should know the MySQL
port. You can get it from MySQL
config or try ports from @Prageeth Roshane' answer. Then you should try to connect from VirtualBox
to MySQL
to finded port. You can use or programm or telnet. If you'll have troubles with connections, try to check that the firewall in VM and in main OS is not blocked your programm (or telnet).
P.S. If you can connect to MySQL
from another PC, but cann't connect from VM, then trouble is in VM's network settings.