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 ...
随机推荐
- 起源-C的故事
———C语言的起源故事(简史)——— C语言在70年代问世的,1978年由美国电话公司(AT&T)贝尔实验室正式发表.B.W.Kernighan和D.M.Ritchit合著了著名的" ...
- On-die termination for DDR
本文转载自: https://blog.csdn.net/weixin_38233274/article/details/81016870 ODT是什么鬼?为什么要用ODT?在很多关于DDR3的博文和 ...
- Vue 路由的模块化
其实就是对路由配置和实例化的过程进行js封装,挂载路由的时候依然在main.js中: 步骤: 1.在src文件夹下新建一个router文件夹,在router文件夹下新建文件router.js; 2.引 ...
- Android几种视频播放方式,VideoView、SurfaceView+MediaPlayer、TextureView+MediaPlayer,以及主流视频播放器开源项目
简单的说下一Android的几种视频播放功能: 1.VideoView:最简单的视频播放 <FrameLayout xmlns:android="http://schemas.andr ...
- python数据类型、if判断语句
python的数据类型: int(整型) float(浮点型) #相较c++,去除了char.long.longlong... str(字符串) #同等c++ sting类型 list(列表) ...
- Z 字形变换
将一个给定字符串根据给定的行数,以从上往下.从左到右进行 Z 字形排列. 比如输入字符串为 "LEETCODEISHIRING" 行数为 3 时,排列如下: L C I R E T ...
- input file禁用手机本地文件选择,只允许拍照上传图片
<input type="file" accept="image/*" capture="camera"> 会有个问题,上传的图 ...
- Android开发 ViewConfiguration 用法
ViewConfiguration 实例获取 ViewConfiguration viewConfiguration = ViewConfiguration.get(Context); 常用对象方法 ...
- linux命令--xargs的使用
xargs 是给命令传递参数的一个过滤器,也是组合多个命令的一个工具. xargs 可以将管道或标准输入(stdin)数据转换成命令行参数,也能够从文件的输出中读取数据. xargs 也可以将单行或多 ...
- python初学心得之一
昨天开始接触并学习python,对python有了初步印象. 一.python主要应用方向 二.python语言类型 三.python2和3的主要区别 四.常见字符编码 五.Python语法初学 一 ...