Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
blitsoftwares authored Jul 15, 2021
1 parent 17dfb7c commit ef140b7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
# How-to-restrict-MySQL-port-access
como bloquear todos os ips e liberar um ip especifico no firewall

On some Linux distributions, port 3306 is open after you install MySQL. This article describes two methods for restricting or blocking access to port 3306 on an unmanaged server.

## Configure firewall rules
You can use iptables to create firewall rules that restrict access to port 3306. The advantage of this method is that you can selectively grant or deny access to port 3306 based on IP addresses or other criteria.

For example, to block external access to port 3306 completely, type the following command:

```
$ iptables -A INPUT -p tcp --dport 3306 -j DROP
```

Similarly, to grant access to a specific IP address and block all others, type the following commands. Replace xxx.xxx.xxx.xxx with the IP address for which you want to grant access:

```
$ iptables -A INPUT -p tcp --dport 3306 -s xxx.xxx.xxx.xxx -j ACCEPT
$ iptables -A INPUT -p tcp --dport 3306 -j DROP
```

0 comments on commit ef140b7

Please sign in to comment.