设置允许指定端口通过防火墙centos7

1.systemctl start firewalld.service(开启防火墙)

2.systemctl stop firewalld.service(开启防火墙)

3.service firewalld restart(从启防火墙)

4.firewall-cmd --zone=public --add-port=4400-4600/udp --permanen(指定端口范围为4400-4600通过防火墙)

Warning: ALREADY_ENABLED: 3306:tcp(说明3306端口通过成功)

5.firewall-cmd --zone=public --remove-port=80/tcp --permanent(关闭指定端口)

6.firewall-cmd --zone=public --list-ports(查看通过的端口)

7.查看防火墙状态 :firewall-cmd --state

8.修改mysql密码:SET PASSWORD = PASSWORD('123456');

9.flush privileges;

10.grant all privileges on *.* to 'root'@'%' identified by'test1234';(将所root用户的所有ip 以密码为test1234登录)

11.flush privileges

12,在10前要先执行这个:update user set host = '%' where user = 'root';

13.在8前要先 use mysql

14.如何更改了mysql端口后 从启服务没有反应时 执行该命令:/usr/sbin/setenforce 0 (

开启了selinux,mysql会无法启动,你会在日志中看到以下错误

[ERROR] Can't start server: Bind on TCP/IP port: Permission denied
[ERROR] Do you already have another mysqld server running on port: 3308

  • 3
    点赞
  • 34
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值