Your MySQL server inside the VM is bound only on localhost
(127.0.0.1
).
To connect from your desktop, you need it to be listening on the bridged network interface, though it's easiest just to have it listen on all interfaces.
Modify your /etc/mysql/my.cnf
(or wherever your my.cnf can be found) so that you either uncomment or add the following line:
bind-address = 0.0.0.0
within the [mysqld]
section so it looks like the following:
...
[mysqld]
bind-address = 0.0.0.0
...
If you are having trouble finding your my.cnf, the places MySQL searches in Unix and Unix-Like Systems is:
File Name Purpose
/etc/my.cnf Global options
/etc/mysql/my.cnf Global options
SYSCONFDIR/my.cnf Global options
$MYSQL_HOME/my.cnf Server-specific options (server only)
defaults-extra-file The file specified with --defaults-extra-file, if any
~/.my.cnf User-specific options
~/.mylogin.cnf User-specific login path options (clients only)
DATADIR/mysqld-auto.cnf System variables persisted with SET PERSIST or SE PERSIST_ONLY (server only)
Note some distributions also assign their own locations (e.g. /etc/mysql/mysql.conf.d/mysqld.cnf
)
See https://dev.mysql.com/doc/refman/8.0/en/option-files.html for more information.
netstat -anutp | grep :<MySQL port number>
on the Ubuntu server? this will show you where MySql is listening.tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 995/mysqld
. The IP Address of the VM server is 192.168.0.19.