Open port on ubuntu 16.04

I cannot access my db remotely, The only thing i found out is the port 3306 is open for 127.0.0.1, I want it open globally. The error i receives on accessing db is No connection could be made because the target machine actively refused it.

I have ubuntu 16.04, Installed mariaDB, The bind-address = 0.0.0.0.

When i hit sudo netstat -plnt it returns :

tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 21013/mysqld
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1172/sshd
tcp6 0 0 :::8080 :::* LISTEN 13710/apache2
tcp6 0 0 :::80 :::* LISTEN 13710/apache2
tcp6 0 0 :::22 :::* LISTEN 1172/sshd
tcp6 0 0 :::443 :::* LISTEN 13710/apache2

There is no 0 0.0.0.0:3306.

How can i allow 0 0.0.0.0:3306.

sudo ufw status returns :

Apache Full ALLOW Anywhere
22 ALLOW Anywhere
3306 ALLOW 161.202.20.0/24
3306 on eth1 ALLOW Anywhere
3306 ALLOW Anywhere
Apache Full (v6) ALLOW Anywhere (v6)
22 (v6) ALLOW Anywhere (v6)
3306 (v6) on eth1 ALLOW Anywhere (v6)
3306 (v6) ALLOW Anywhere (v6)

On accessing the DB remotely i receives No connection could be made because the target machine actively refused it..

9

1 Answer

To allow a port

sudo ufw allow 3306

if its ufw is not installed is probably iptables

sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like