1.确定虚拟机可以联网,确保MySQL服务开启。
2.关闭Linux防火墙
1:查看防火状态
systemctl status firewalld
service iptables status
2:暂时关闭防火墙
systemctl stop firewalld
service iptables stop
3:永久关闭防火墙
systemctl disable firewalld
chkconfig iptables off
4:重启防火墙
systemctl enable firewalld
service iptables restart
3.授权MySQL,允许远程用户登录访问MySQL
从任何主机上使用root用户,密码:youpassword(你的root密码)连接到mysql服务器:
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
4.操作完后切记执行以下命令刷新权限
mysql>FLUSH PRIVILEGES
5.navicat远程链接MySQL,链接测试 ,ok