没有安装的话看 https://blog.csdn.net/chenhj153/article/details/102841455
/etc/init.d/iptables status #查看防火墙信息 这里可以查看你开放的端口
vim /etc/sysconfig/iptables 在文件中添加-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT开放3306端口 然后按esc 输入 : wq 保存退出
重启防火墙使改动生效 /etc/init.d/iptables restart 关闭防火墙 service iptables stop
永久关闭防火墙 [root@localhost liufuwen]# chkconfig iptables off
永久关闭后启用 [root@localhost liufuwen]# chkconfig iptables on
1、进入你的mysql:mysql -u root -p然后输入你的密码进入mysql 2、use mysql;进入到该数据库 3、查看用户表中的权限select host, user, password from user; host字段中%是开启所有权限
4、执行 Grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;这里123456是访问的密码,root是访问的用户名可以自行修改
5、再次执行select host, user, password from user; 查询发现root权限新增 % 这就表示所有外在ip都可以通过root连接mysql