View Connect Windows Virtual Machine to Host Mac MySQL Server

Overview

This provides a method to connect a guest Windows Virtual Machine to enable it to see a MySQL server on the host Mac OS X computer.

This enables both the host and guest operating systems to share the same database rather than have to setup an additional MySQL server on the Windows virtual machine. This will allow Sparx Systems Enterprise Architect to use the MySQL server to store and transfer project data instead of the file-based .eap.

The instructions show this being done for VMWare Fusion but the same principles apply to Parallels Desktop for Mac. If you use Codeweavers Crossover for Mac you need not do this as the application runs in it’s own space rather than a virtual machine and can use the Mac’s MySQL directly.

Establish the Network Address for Mac - As Seen By Windows Virtual Machine

The first step is to establish a network connection to allow the virtual machine to talk to the Mac host.
1. Power down (shut down) the Microsoft Windows within the Virtual Machine.
2. Select in VMWare Fusion Virtual Machines|Settings from either the top menu or the drop-down list under the VM icon top right

WindowsXPVMSettings.jpg

3. Select the Network settings

WindowsXPVMSettings_Network.jpg

4. Add a new network adapter and place it into host-only mode as shown. The purpose of this second adapter is to ensure that the virtual machine can always call the Mac by the IP address the Mac uses on that private, host-only network

Establish IP Address of Mac on Host-Only Network

Now we need to find out what the address of the Mac is on this network.

5. Using the Terminal application issue the command ifconfig vmnet1

Terminal_vmnet1.gif

In this case the IP address we need is in the oval annotation - after ‘inet’.

Configure Windows ODBC

Now we know what the Mac’s IP address is we can set up the Windows OS Open Database Connectivity (ODBC) driver to point it at the MySQL server and database on the Mac.

6. In the Windows Control Panel select and open the Admin Tools (in Windows XP at least)

WindowsControlPanel_AdminHighlight.jpg

7. The select and open the ODBC control panel
WindowsControlPanel_ODBCHighlight.jpg

8. Choose User DSN and then Configure…

ODBC_UserDSN.jpg

This assumes that you’ve got the ODBC driver for MySQL for your version of Windows that you’re running. This needs to be installed first.


9. Enter the Mac’s IP address from step 5 together with the connection detail for the MySQL database you’re connecting to.

ODBC_ConnectorSettings.jpg

In the case of Sparx Systems’ Enterprise Architect the database is named basemodel

10. Check the connection using ‘Test’ and, if necessary, ‘Diagnostics’. The usual problems are that either the wrong address is used or that the wrong password / user (if needed) have been used.

  • remember - you will need to grant access to the user+pw specified in the ODBC control panel within MySQL (or an admin tool that you use to manage/add privileges to user accounts) using the username@IP_address_from_Step_5
  • you may need to check to see if your VM firewall is blocking access

References

•

 

© 2010 Eclectica Systems Ltd.