Trying to connect to remote MySQL host (error 2003)

Solution 1:

Based on your response, you need to find if there is a device between you and the server that blocks your connection. You should also ensure that you can telnet to 3306 on that server's ethernet address when logged into the server... if not, you probably have not got the service bound to the ethernet in my.cnf... see the bind-address parameter.

Solution 2:

You should check your MySQL Server configuration to see if it bind to 127.0.0.1, then you can only connect to mysql if your app is on same server. There's an easy way, to have webamin installed and you can control via web interface.

Solution 3:

This may due to 3306 port is closed , check your server port status

http://www.yougetsignal.com/tools/open-ports/

If it shows closed, that means you can't access it from out side the machine , to open the port

ufw - Uncomplicated Firewall

The default firewall configuration tool for Ubuntu is ufw. The following are some examples of how to use ufw:

First, ufw needs to be enabled. From a terminal prompt enter:

sudo ufw enable

To open a port (mysql):

sudo ufw allow 3306

To see the firewall status, enter:

sudo ufw status