How to set up a firewall to enable MySQL to connect remotely

Source: Internet
Author: User
Tags iptables

Because of the filtering function in the firewall, it is forbidden to enter the outside data message, can set

Iptables-i input-p tcp-d 192.168.18.9--dport 3306-j ACCEPT

Iptables-i output-p tcp-s 192.168.18.9--sport 3306-j ACCEPT


Note that this rule must be placed on top of the top-I INPUT is appended to the top by default, so that it can be blocked from the beginning otherwise. For security best set to port. The TCP setting is passed because the remote connection uses SSH, based on TCP.

So you can log on to MySQL remotely.

Of course, first of all, you have this user's permission in MySQL.

The ' root ' @ ' 192.168.%.% ' user needs to exist and have permission to log in as root from the 192.168.%.% network.

You can use statements directly

MariaDB [(None)]> grant all privileges on * * to ' root ' @ ' 192.168.%.% ' identified by ' 150370992390KD ';

So you can connect MySQL from a distance.

This article is from the "Gusu City" blog, make sure to keep this source http://ji123.blog.51cto.com/11333309/1957514

How to set up a firewall to enable MySQL to connect remotely

Related Article

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.