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 ...
随机推荐
- sql server top 10 IO性能查询
use master go ), ((case qs.statement_end_offset then datalength(qt.text) else qs.statement_end_offse ...
- 关于如何在电脑上安装adb来操作手机(Android)的方法及步骤
1.需要真实的安卓手机: 2.安卓手机需要开启USB调试模式,允许电脑进行调试(各个手机的开启方式可能不同,不知道的自行百度): 3.电脑需要安装ADB驱动,这里提供一个下载地址:https://ad ...
- 4种好用的python编辑器
1.Sublime Text: 这是一个轻量级的代码编辑器,跨平台,支持几十种编程语言,包括Python,Java,C/C++等,小巧灵活,运行轻快,支持代码高亮.自动补全.语法提示,插件扩展丰富,是 ...
- springboot 问题总结
一:返回格式化日期 如果我们是用fastjson处理成jsonString,可以通过下面两种方式处理 1,在接受实体上@JSONField(format="yyyy-MM-dd HH:mm: ...
- C++实现根据路径读取文件内容
已知文件路径,用C++实现读取对应文件的内容,代码如下: bool LoadShaderStr(const char* szShaderPath,string& strShaderStr) { ...
- python-day18 JS正则,组件BootStrap、EasyUI、JQueryUI1,插件轮播,django
@第一节课程内容 js正则 登录注册验证 @text-判断字符串是否符合规定的正则 @exec-获取匹配的数据 bootstrap(组件) –css –js 学习bootstrap规则 jQueryu ...
- python———day03
一.字符串格式化输出: 占位符 %s(字符串) %d(整数) %f(浮点数,约等于小数) name = input("Name:") age = input("Ag ...
- Python学习随笔(1)--可视化工具plotly使用
把数据库某列数据取出来,然后再在本地生成html文件形成可视化视图显示 #!/usr/bin/python# coding=utf-8 import pymysqlimport plotly.plot ...
- es集群搭建
1.复制5份es,版本要相同,且各个节点上jdk版本也要相同,否则会报数据同步格式不一致 invalid internal transport message format. 2.配置elastic ...
- 2017-11-11 Sa Oct Is it online
2017-11-11 Sa Oct Is it online 9:07 AM After breakfast I tried connecting to the course selection sy ...