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;#刷新权限

在 Centos 7 中防火墙默认由 firewalld 来管理
1. 查看防火墙状态
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+防火墙,允许远程的更多相关文章

  1. centos7下使用x11远程带窗口安装Oracle

    目录 centos7静默安装oracle11gR2 文章目录 一.检查硬件要求 1.内存要求: 2.安装包: 二.环境准备 1.安装必要的工具 2.关闭防火墙 3.关闭Selinux 4.安装Orac ...

  2. [转帖]CentOS7安装xrdp(windows远程桌面连接linux)

    CentOS7安装xrdp(windows远程桌面连接linux) https://blog.csdn.net/sgrrmswtvt/article/details/81869208 You Konw ...

  3. CentOS7 修改防火墙,增加外网可以访问的端口号

    CentOS7 修改防火墙,增加外网可以访问的端口号: vim /etc/sysconfig/iptables 增加一条 -A INPUT -p tcp -m state --state NEW -m ...

  4. Centos7开启防火墙并且使MYSQL外网访问开放3306端口

    http://www.cnblogs.com/kreo/p/4368811.html CentOS7默认防火墙是firewalle,不是iptables #先检查是否安装了iptables servi ...

  5. CentOS7 mariadb 修改编码

    CentOS7 mariadb 编码的修改: 网上看了不少的解决方案,要么是比较老的,要么是不正确,测试成功的方式,记录备查. 登录MySQL,使用SHOW VARIABLES LIKE 'chara ...

  6. CentOS7.3防火墙firewalld简单配置

    今天安装了centos7.3, 想用iptables的save功能保存规则的时候发现跟rhel不一样了,  后来度娘说centos用的是firewalld而不是iptables了, 平时工作都是用re ...

  7. centos7 关闭防火墙

    centos7 关闭防火墙 1.firewall相关的操作    查看防火墙状态 firewall-cmd    --state 关闭防火墙 systemctl  stop   firewalld.s ...

  8. centos7 mariadb 设置root密码

    centos7 mariadb 设置root密码   修改root密码1.以root身份在终端登陆,必须2.输入 mysqladmin -u root -p password root后面的 root ...

  9. centos7 mariadb mysql max_connections=214 无法修改的问题

    centos7 mariadb mysql max_connections=214 无法修改的问题 /etc/my.cnf.d/mariadb-server.cnf [mysqld] max_conn ...

随机推荐

  1. Allegro16.6 PCB 导入DXF 外框后曲线不闭合

    Allegro16.6 PCB 导入DXF  外框后曲线不闭合,边框不封闭导致的z-copy无法用的问题.解决办法: 菜单栏依次选择 shape--compose shape,options选择好ou ...

  2. [STM32F103]串口UART配置

    l 串口时钟使能,GPIO时钟使能: RCC_APB2PeriphClockCmd(); l 串口复位: USART_DeInit(); 这一步不是必须的 l GPIO端口模式设置: GPIO_Ini ...

  3. python3使用pymysql库连接MySQL的常用操作

    #导入pymysql模块import pymysql #连接数据库connect = pymysql.connect( host='localhost', port=3306, user='root' ...

  4. mongo 数据库

    一.管理mongo 配置文件在/etc/mongod.conf 默认端口27017 启动                    sudo service mongod start 停止         ...

  5. OO第二单元(电梯)单元总结

    OO第一单元(求导)单元总结 这是我们OO课程的第二个单元,这个单元的主要目的是让我们熟悉理解和掌握多线程的思想和方法.这个单元以电梯为主题,从一开始的最简单的单部傻瓜调度(FAFS)电梯到最后的多部 ...

  6. Java Native调用C方法

    1.通过JNI生成C调用的头文件:Java源码: import java.io.File; public class Test { static { System.load("D:" ...

  7. python docker 多进程提供 稳定tensorflow gpu 线上服务

    尝试了太多的python多进程的服务,在tensorflow 的线上GPU服务中总是不理想.tensorlfow serving docker服务这些也有些不便. 今天抽空给大家分享一个成功的经验.失 ...

  8. VC使用双缓冲制作绘图控件

    最近用VC做了一个画图的控件.控件在使用的时候遇到点问题.在控件里画了图之后切换到其他页面,等再切换回来的时候,发现控件里画的图都不见了.这是因为VC里面,当缩小.遮挡页面后客户区域就会失效,当再次显 ...

  9. Java学习笔记 -- Java定时调度工具Timer类

    1 关于 (时间宝贵的小姐姐请跳过) 本教程是基于Java定时任务调度工具详解之Timer篇的学习笔记. 什么是定时任务调度 基于给定的时间点,给定的时间间隔或者给定的执行次数自动执行的任务. 在Ja ...

  10. js中的变异数组

    [ 'push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse' ] 以上几个数组的方法会改变原数组,称之为数组的变异方法.