Step 2: Connect to the centos system by using the local machine or SSH, run the "/sbin/iptables-I input-P TCP -- dport 3306-J accept" command, and confirm.
If you want to open any port, write the port directly in the command. Generally, the default port for a web site is port 80, Tomcat is port 8080, and MySQL database is port 3306, the specific port numbers can be modified in your own software. Respect Original reprinted web site http://www.pc811.com/6/7/26004.html
Step 2: Run the "/etc/init. d/iptables startus" command to view the port information that has just been added to the firewall exception.
Step 2: This is not completed. You must execute the "/etc/rc. d/init. d/iptables save" command and confirm.
Note: If you do not execute this command, the port number added in step 1 will be invalid after the computer is restarted or the firewall is restarted, the exception port added at Step 1 does not take effect.
Step 2: Execute the "service iptables restart" command and make sure that the firewall is started after four OK prompts are displayed. Then, all the exceptional port numbers added in step 1st of this article will take effect.
Add an exception port to the centos Firewall