Access MySQL instance on VM

from the Artful MySQL Tips List


This assumes a Windows machine running MySQL in a Linux guest virtual machine using MySQL's "legacy" interactive username-password authentication.

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.

Last updated 24 Sep 2020


Return to the Artful MySQL Tips page