Access MySQL instance on VM

from the Artful MySQL Tips List


This assumes a Windows machine running MySQL in a Linux guest virtual machine.

1 Configure the VM to use a bridged LAN connection, e.g., for VMWare it's an option you can set when you click on Settings->Hardware->Network Adapter.

2 Also enable bridged connection in the host network connection.

3 In the Linux guest, run ip addr to the find IP address of the VM.

4 In the Windows host, open %windir%system32driversetchosts in a text editor as an admin user, and add the IP address found in step 3 followed by a convenient name (without spaces) for the VM, e.g., ....

192.168.1.44   Ubuntu1710

5 When the VM is running, access the VM MySQL instance as you would any other instance, e.g., via the MySQL client ...

mysql -hHOST -uUSR -pPWD

substituting for HOST the name you wrote into %windir%system32driversetchosts, and for USR and PWD your MySQL username and password for the VM MySQL instance.

Beware that for this to work, the VM MySQL instance must have been configured to use MySQL's "legacy" interactive username-password authentication.



Return to the Artful MySQL Tips page