centos7 开放3306端口并可以远程访问

开启远程访问:

GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘root‘ WITH GRANT OPTION; 允许任何ip以root用户登录

flush privileges;立即生效

CentOS 7.0默认使用的是firewall作为防火墙,这里改为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 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
:wq! #保存退出

3.重启配置,重启系统
systemctl restart iptables.service #重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动

原文地址:https://www.cnblogs.com/myibm/p/9488657.html

时间: 2024-08-01 15:23:08

centos7 开放3306端口并可以远程访问的相关文章

linux下mysql开启远程访问权限及防火墙开放3306端口

开启mysql的远程访问权限 默认mysql的用户是没有远程访问的权限的,因此当程序跟数据库不在同一台服务器上时,我们需要开启mysql的远程访问权限. 主流的有两种方法,改表法和授权法. 相对而言,改表法比较容易一点,个人也是比较倾向于使用这种方法,因此,这里只贴出改表法 1.登陆mysql mysql -u root -p 2.修改mysql库的user表,将host项,从localhost改为%.%这里表示的是允许任意host访问,如果只允许某一个ip访问,则可改为相应的ip,比如可以将l

centos6.0如何开启远程访问权限及防火墙开放3306端口

在Linux中装上mysql之后,发现windows中用navicat连接数据库失败,这是由于默认mysql的用户是没有远程访问的权限的,因此当navicat程序跟mysql数据库不在同一台服务器上时,我们需要开启mysql的远程访问权限才能正常访问mysql数据库. 主要的有两种方法,改表法和授权法,下面将分别介绍. 1.登陆mysql [java] view plain copy mysql -u root -p 2.改表法:修改mysql库的user表,将host项,从localhost改

CentOS7开放防火墙端口

~~~~~~~~~~~~开放某个端口~~~~~~~~~~~~firewall-cmd --zone=public --add-port=6669/tcp --permanentfirewall-cmd --reload systemctl start firewalldsystemctl stop firewalld 原文地址:https://www.cnblogs.com/t-road/p/11211721.html

Centos7 开放防火墙端口命令

Centos 7 使用firewalld代替了原来的iptables,使用方法如下: >>>关闭防火墙 systemctl stop firewalld.service             #停止firewallsystemctl disable firewalld.service        #禁止firewall开机启动 >>>开启端口 firewall-cmd --zone=public --add-port=80/tcp --permanent 命令含义

CentOS7 开放服务端口

CentOS 7 默认是firewall防火墙 如果你想让一个web服务可以被其它机子访问,就得开放这个服务的端口,不然就会被拦截 1. 开放端口命令 firewall-cmd --add-port=4010/tcp –permanent 2. 查询端口状态 firewall-cmd --query-port=4010/tcp 3. 重启防火墙 firewall-cmd –reload Finally: 你的web服务 4010端口应该已经打开了,可以通过防火墙了

CentOS 7 开放3306端口访问

CentOS 7.0默认使用的是firewall作为防火墙,这里改为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

centos7 开放mongodb端口

CentOS 7 默认没有使用iptables,所以通过编辑iptables的配置文件来开启端口是不可以的 CentOS 7 采用了 firewalld 防火墙 如要查询是否开启27019端口则: 1 2 [[email protected] ~]# firewall-cmd --query-port=27019/tcp no 显然27019端口没有开启 下面我们开启27019端口: 1 2 [[email protected] ~]# firewall-cmd --add-port=27019

tomcat 安装记录 centos7 开放对外端口

//端口查询 [[email protected] bin]# firewall-cmd --query-port=9090/tcp no //添加端口 [[email protected] bin]# firewall-cmd --add-port=9090/tcp --permanent success //重载防火墙 [[email protected] bin]# firewall-cmd --reload success //再次查询 [[email protected] bin]#

【Linux笔记】第八篇、开放MariaDB—3306端口

若没开放3306端口,远程连接或提示 2003 can't connect to mysql server on 10060 一.安装iptables-services yum install iptables-services   若没安装,service iptables save会报错 二.设置防火墙 开放3306端口 iptables -I INPUT -p tcp --dport 3306 -j ACCEPT 保存设置 service iptables save 重启服务  servi