Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Linux CentOS 6 - IPTables

I would like to know what command line(s) I need to enter to determine what my MySQL port is, or rather what config file I could check. I know it's typically 3306 but I'm not 100% sure this is the case. It would just be nice to know how to check for future reference.

In addition, would it be possible to restrict that port to only accept my server's IP address? Or I guess what I'm asking is if I can set up IPTables to only allow my server to talk to my MySQL database and deny all other incoming IPs, etc.

When performing iptables -L I see this :

ACCEPT tcp -- anywhere anywhere tcp dpt:mysql

which I'm assuming isn't ideal. Forgive me if I'm too vague.

Edit: also forgive me if I'm asking too many questions.

share|improve this question

migrated from webmasters.stackexchange.com Dec 22 '11 at 17:21

This question came from our site for pro webmasters.

1 Answer 1

up vote 0 down vote accepted

Without checking config files, "netstat -pltn" is your friend. It Will tell you the process name and number of running tcp servers.

As for restrictions with iptables, after accepting valid connections you should drop the unwanted ones.

If you are connecting from the same machine, it's better to configure MySQL to bind to localhost.

share|improve this answer
    
The answer to serverfault.com/questions/201349/… is quite good for this question. –  itorres Dec 22 '11 at 17:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.