0

Due to the nature of my project, I need to open port 3306 on a cloud server running CentOS 6. Using this site: http://www.yougetsignal.com/tools/open-ports/ I can see whether a port is open or not. Port 3306 seems to be closed, therefore any attempt of remote connection fails. I've already tried to open it via iptables like so:

iptables -I INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
iptables -I FORWARD -i eth0 -p tcp --destination-port 3306 -j ACCEPT

Command iptables -L returns the following:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:mysql

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:mysql

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Command netstat -tlnp returns the following:

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      2694/mysqld

So I assume the daemon is listening through that port. I have to mention that before trying this, I installed MySQL from yum repository, then updated it from remi-repo, and then updated again to the latest version via MySQL official repository, maybe that messep up something? Command mysql upgrade ran smoothly but I may be missing something. Maybe it's an issue from the service provider? Am I missing something? Thanks in advance.

EDIT Is it normal that mysqld status is stopped?:

# service mysqld start
Starting mysqld:                                           [  OK  ]
# service mysqld status
mysqld is stopped
  • No, it is not normal, you should look at MySQL log files to see what is happening... Note that MySQL can also use an Unix socket, and not necessarily a TCP one. – Patrick Mevzek Jan 31 '18 at 15:49
  • @PatrickMevzek at /var/log location there's only mysqld.log, and it stopped recording right after I updated mysql to the last version. There's no /var/log/mysql/ location, that shouldn't be normal right? – oscar_vb Jan 31 '18 at 17:35
1

Your host doesn't have an active firewall blocking any connections, so the iptables rules you added effectively do nothing. Your system accepts all connections anyway.

If your connection is firewalled, then the firewall is outside the server (e.g. Amazon EC2 security groups, GCE firewall, etc.).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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