I understand this question has been asked but they all say the same thing which I have tried and failed.
Basically using this site: http://www.yougetsignal.com/tools/open-ports/
I can see my 3306 port is closed and trying to get a client to connect remotely is not working. I have changed the /etc/mysql/my.cnf
file to both commented out bind-address
and also change it to 0.0.0.0
but neither worked.
I have tried iptables -A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT
but it doesn't seem to do anything.
My iptables all show ACCEPT
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3306
Does anyone have any other idea as to why this port is still blocked?
Thanks
Additional information [EDIT]
When I try to use: mysqli_connect('XX.XX.XX.XXX', "DBUSer", "DBPassword", "DBName", 3306);
it gives my the error PHP Warning: mysqli_connect(): (HY000/2003): Can't connect to MySQL server on 'XX.XX.XX.XX (60)
I also typed into my server:
ufw status;
Status: inactive
Thanks everyone.
Turns out the team that set up the server needed to make a change on their end. They didn't say specifically but it opened the port up. (I imagine it was a firewall setting)
I also had to grant privileges to all host with:
GRANT ALL ON *.* to DBUsername@'%' IDENTIFIED BY 'DBPassword';
I had always seen the DBUsername@'xx.xx.xx.xxx' and didn't know I had to '%' it to work for all IPs.
Thanks