1.确保mysql已经在Linux安装,并且已经运行。
运行mysql命令:
systemctl status mysqld
查看mysql状态
systemctl status mysqld
显示running就是正在运行,
2.确定好防火墙已经关闭。
大部分连接不上就是因为防火墙没有关闭。
查看防火墙状态
firewall-cmd --state
显示running是没有关闭 显示not running就是已经关闭。
如果还没有关闭
临时关闭 service firewalld stop
永久关闭(禁止开机启动)systemctl disable firewalld.service
如果你的linux有iptables 可以直接永久关闭
systemctl disable iptables.service
不知道iptables自行谷歌,我也不怎么清楚,额。。