7、mysql允许外网访问
GRANT ALL PRIVILEGES ON dl_adb_all.* TO 'chenjian'@'%'IDENTIFIED BY 'chenjian110' WITH GRANT OPTION;
//db_adb_all指数据库名称.*表示适配所有表 %号代表所有IP地址
flush privileges; //更新缓存
drop user 'root'@'%';//关闭root远程访问
方法二更安全
CREATE USER 'chenjian'@'%' IDENTIFIED BY 'chenjian110';//创建用户chenjian
grant all privileges on dl_adb_all.* to 'chenjian'@'%';//允许chenjian在所有(%)主机访问,但是只允许访问db_adb_all
8、防火墙控制
systemctl stop firewalld //暂停防火墙
systemctl disable firewalld //关闭防火墙
systemctl status firewalld //查看防火墙状态
vi /etc/selinux/config
把SELINUX=enforcing 改成 SELINUX=disabled //永久关闭selinux 需重启