centos7+mariadb+防火墙,允许远程
centos7 已安装mariadb,想要允许数据库远程==数据库权限允许+系统允许
mariadb:允许数据库用户在所有ip使用某个用户远程
GRANT ALL PRIVILEGES ON *(数据库,所有用 . 代替)* TO 'username'@'%'IDENTIFIED BY 'passwd' WITH GRANT OPTION;
WITH GRANT OPTION可以不加,加了是给定部分权限 #如果针对某个ip:
create user 'root'@'IPAdress' identified by 'passwd';
flush privileges;#刷新权限
firewall-cmd --state ## 结果显示为running或not running
2. 关闭防火墙firewall
systemctl stop firewalld.service
systemctl disable firewalld.service
3. 关闭防火墙firewall后开启
systemctl start firewalld.service
4. 开启端口
## zone -- 作用域
## add-port=80/tcp -- 添加端口,格式为:端口/通讯协议
## permanent -- 永久生效,没有此参数重启后失效
firewall-cmd --zone=public --add-port=3306/tcp --permanent
## 开启3306端口后,workbench或naivcat 就能连接到MySQL数据库了
5. 重启防火墙
firewall-cmd --reload
6. 常用命令介绍
firewall-cmd --state ##查看防火墙状态,是否是running
firewall-cmd --reload ##重新载入配置,比如添加规则之后,需要执行此命令
firewall-cmd --get-zones ##列出支持的zone
firewall-cmd --get-services ##列出支持的服务,在列表中的服务是放行的
firewall-cmd --query-service ftp ##查看ftp服务是否支持,返回yes或者no
firewall-cmd --add-service=ftp ##临时开放ftp服务
firewall-cmd --add-service=ftp --permanent ##永久开放ftp服务
firewall-cmd --remove-service=ftp --permanent ##永久移除ftp服务
firewall-cmd --add-port=80/tcp --permanent ##永久添加80端口
iptables -L -n ##查看规则,这个命令是和iptables的相同的
man firewall-cmd ##查看帮助
systemctl status firewalld.service ##查看防火墙状态
systemctl [start|stop|restart] firewalld.service ##启动|关闭|重新启动 防火墙 ##查询端口号80 是否开启
firewall-cmd --query-port=80/tcp
更多命令,使用 firewall-cmd --help 查看帮助文件
CentOS 7.0可以改为iptables防火墙。
1、关闭firewall:
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl mask firewalld.service
2、安装iptables防火墙
yum install iptables-services -y
3.启动设置防火墙
# systemctl enable iptables
# systemctl start iptables
4.查看防火墙状态
systemctl status iptables
5编辑防火墙,增加端口
vi /etc/sysconfig/iptables #编辑防火墙配置文件
-A INPUT -m state --state NEW -m tcp -p tcp --dport -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport -j ACCEPT
:wq! #保存退出
6.重启配置,重启系统
systemctl restart iptables.service #重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动
centos7+mariadb+防火墙,允许远程的更多相关文章
- centos7下使用x11远程带窗口安装Oracle
目录 centos7静默安装oracle11gR2 文章目录 一.检查硬件要求 1.内存要求: 2.安装包: 二.环境准备 1.安装必要的工具 2.关闭防火墙 3.关闭Selinux 4.安装Orac ...
- [转帖]CentOS7安装xrdp(windows远程桌面连接linux)
CentOS7安装xrdp(windows远程桌面连接linux) https://blog.csdn.net/sgrrmswtvt/article/details/81869208 You Konw ...
- CentOS7 修改防火墙,增加外网可以访问的端口号
CentOS7 修改防火墙,增加外网可以访问的端口号: vim /etc/sysconfig/iptables 增加一条 -A INPUT -p tcp -m state --state NEW -m ...
- Centos7开启防火墙并且使MYSQL外网访问开放3306端口
http://www.cnblogs.com/kreo/p/4368811.html CentOS7默认防火墙是firewalle,不是iptables #先检查是否安装了iptables servi ...
- CentOS7 mariadb 修改编码
CentOS7 mariadb 编码的修改: 网上看了不少的解决方案,要么是比较老的,要么是不正确,测试成功的方式,记录备查. 登录MySQL,使用SHOW VARIABLES LIKE 'chara ...
- CentOS7.3防火墙firewalld简单配置
今天安装了centos7.3, 想用iptables的save功能保存规则的时候发现跟rhel不一样了, 后来度娘说centos用的是firewalld而不是iptables了, 平时工作都是用re ...
- centos7 关闭防火墙
centos7 关闭防火墙 1.firewall相关的操作 查看防火墙状态 firewall-cmd --state 关闭防火墙 systemctl stop firewalld.s ...
- centos7 mariadb 设置root密码
centos7 mariadb 设置root密码 修改root密码1.以root身份在终端登陆,必须2.输入 mysqladmin -u root -p password root后面的 root ...
- centos7 mariadb mysql max_connections=214 无法修改的问题
centos7 mariadb mysql max_connections=214 无法修改的问题 /etc/my.cnf.d/mariadb-server.cnf [mysqld] max_conn ...
随机推荐
- this 指向详细解析(箭头函数)
前言 this 指向问题是入坑前端必须了解知识点,现在迎来了ES6时代,因为箭头函数的出现,所以感觉有必要对 this 问题梳理一下,遂有此文 在非箭头函数下, this 指向调用其所在函数的对象,而 ...
- one-hot编码理解
one-hot是比较常用的文本特征特征提取的方法. one-hot编码,又称“独热编码”.其实就是用N位状态寄存器编码N个状态,每个状态都有独立的寄存器位,且这些寄存器位中只有一位有效,说白了就是只能 ...
- S表示1,L表示2,计算由S和L组成的序列之和为N的组合
def func(n): def calc_str(s): s = s.strip() if s is not None else "" s = s.upper() result ...
- PHP简单的长文章分页教程 附源码
PHP简单的长文章分页教程 附源码.本文将content.txt里的内容分割成3页,这样浏览起来用户体验很好. 根据分页参数ipage,获取对应文章内容 include('page.class.php ...
- 修改 Vultr 登录密码
Debian,Ubuntu 访问控制台,打开在线 Console,点击右上角的 “Send CtrlAltDel”,按 ESC 键启动 GRUB boot prompt. 按 e 编辑第一启动项.按 ...
- session的处理机制
https://blog.csdn.net/deepwishly/article/details/6659613 https://blog.csdn.net/dz45693/article/detai ...
- python学习笔记----random
import random import string # 随机整数: print random.randint(1,50) >>> print(random.randint(1,5 ...
- FI-盘盈盘亏借贷科目
资产的盘盈盘亏一般分两步:第一步,批准前调整为账实相符:第二步,批准后结转处理.库存现金.存货.固定资产.工程物资的盘盈盘亏的账务处理见下图: 以上科目中可能并不完整,比如“原材料等科目”就可能包括“ ...
- React-Native: bios打开VT-x选项
问题: 我在Android Studio新建一个虚拟机的时候出现如图错误: 解决方案:重启电脑,开机的时候不停的按f12(不同的主机不一样),进入bios,然后打开Virtualization Tec ...
- CS通用项目系统搭建——三层架构第二天
一.编写配置文件 首先找到编写配置文件的位置.winform会在app.config.webform写在web.config中. <?xml version="1.0" en ...