---
title: "mysql远程访问服务器开通3306端口"
author: "jinxhj2003"
date: "2012-11-15T15:45:49Z"
tags: []
categories: ["操作系统"]
slug: "mysql-3306"
draft: false
lastmod: "2012-11-15T15:45:49Z"
id: 1726331
url: "https://jinxhj2003.iteye.com/blog/1726331"
---


1、设定
[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT
[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

2、保存
[root@localhost ~]# /etc/rc.d/init.d/iptables save
 
3、重启防火墙
[root@localhost ~]# service iptables restart
 
4、查看
[root@localhost ~]# /etc/init.d/iptables status