检查远程的虚拟机是否可以ping通过
查看虚拟机IP为192.168.38.128

cmd窗口ping 192.168.38.128,出现如下界面说明是可以的

检查虚拟机mysql的端口号是否对外开通
比如我们能用xshell等远程工具连接虚拟机上的linux,是因为开放了22端口
查看mysql的端口,在mysql命令行模式下执行以下命令就可以查看,查到的结果是3306
show variables like'%port%';

查看虚拟机的3306端口是否开放
cmd下执行telnet 192.168.38.128 3306
无法执行,别方,这是因为Windows telnet默认是关闭的

按照红框提示开启telnet

重新打开cmd窗口执行命令,结果是无法连接,这是因为虚拟机上的3306并没有对外开放,可以用22的试下效果就知道了

这个时候说明你没有开启Mysql 3306的远程端口,参考上一篇文章开启远程端口后再次链接就行了
网友评论