Not able to connect to mySQL database from external server

cDGo

Verified User
Joined
Sep 21, 2012
Messages
84
[Solved] Not able to connect to mySQL database from external server

I've got the situation that we connect from desktops to the webservers mySQL server.
And that has been working great for ever and still is working.
I needed to add the host of the local pc to the MySQL hosts and the connection was possible.

Now I tried to connect from one of my other servers to the same database and I get a connection refused.

I tried it with MySQL, PDO and MySQLi.
All give simular errors:
Connection failed: Connection refused

I've added the server's IP to the MySQL host, added the IP to the firwall to no avail.
Then placed the bare Essentials connect script over to the target server and found out I could only connect when the server is "localhost".
So the servers IP or the users domainname does not connect.
While connecting from the pc works?

So what did I miss to get it connected?
 
Last edited:
Execute as user "da_admin":

GRANT ALL PRIVILEGES ON <database>.*
TO '<username>'@'<ip address>'
IDENTIFIED BY '<password>';

FLUSH PRIVILEGES;

Replace <database> with the database name, <username> with the username, <password> with the password and <ip address> with the IP address of the remote host.
 
Hi Wattie,

Thanks for the reply.
Tested it, but made no difference.

Just wondering what this command will do differently/additionally than adding the host in the GUI of DA?

I did found out that disabeling the firewall (CSF) did the trick and let the connection work.
So I only needed to add the 3306 port for outgoing traffic, and problem solved!
 
Last edited:
Of course you must unblock it via the firewall. But you wrote that you did it in the first post. That's why I didn't say it :)
 
Back
Top