Linux iptables opens the MySQL port to allow remote access

Source: Internet
Author: User
Modify the firewall configuration file:
VI/etc/sysconfig/iptables

Add the following line:

-A RH-Firewall-1-INPUT-M State-State new-m tcp-p tcp-dport 3306-J accept
If you want to activate ports such as 21, you only need to replace 3306 with the ports to be opened, such as 21.
After configuration, restart iptable
Service iptables restart
Then you can access MySQL from other machines.

Note:
-A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 3306-J accept
-A RH-Firewall-1-INPUT-J reject -- reject-with ICMP-host-prohibited

-A RH-Firewall-1-INPUT-J reject -- reject-with ICMP-host-prohibited
It indicates that ICMP access is denied. If other packets are returned, an error is returned indicating that access is disabled on the host.

The line for enabling port 3306 must be before ICMP-host-prohibited.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.