-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17dfb7c
commit ef140b7
Showing
1 changed file
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |