Error connecting to remote MySQL
I have two servers, and I recently upgraded one of them. The one that has been upgraded hosts the main MySQL database.
The other server has several sites that access this database. They all worked fine when accessing the old server, but now I'm getting this error:
I haven't been able to find anything about the error code (4), so I'm at a loss. Things I've done: 1. Made sure that I could log in to MySQL locally using the username and password on the remove server. 2. SSH'ed to the remote server and made sure that I could ping the new one. 3. Double checked that the remote server's IP was listed as an "Access Host" in cPanel. 4. Just to be safe, double checked that it's also listed as an "Access Host" in WHM. 5. Whitelisted the remote server's IP in my firewall (it wasn't blacklisted, anyway) If it matters, I'm connecting via PHP:
I also tried using mysql_connect("example.com"...), and then tried specifying the port with mysql_connect("example.com:3306"...), but neither made any difference. I'm sure that this is an issue of granting permission to the remote server, but where else do I need to grant it?
Can't connect to MySQL server on '123.45.67.89' (4)
I haven't been able to find anything about the error code (4), so I'm at a loss. Things I've done: 1. Made sure that I could log in to MySQL locally using the username and password on the remove server. 2. SSH'ed to the remote server and made sure that I could ping the new one. 3. Double checked that the remote server's IP was listed as an "Access Host" in cPanel. 4. Just to be safe, double checked that it's also listed as an "Access Host" in WHM. 5. Whitelisted the remote server's IP in my firewall (it wasn't blacklisted, anyway) If it matters, I'm connecting via PHP:
$user = [username];
$pass = [password];
$dbh = mysql_connect("123.45.67.89", $user, $pass, false) or die(mysql_error());
I also tried using mysql_connect("example.com"...), and then tried specifying the port with mysql_connect("example.com:3306"...), but neither made any difference. I'm sure that this is an issue of granting permission to the remote server, but where else do I need to grant it?
-
Can you telnet the remote server via port 3306? telnet IP 33060 -
I just tried and... no, it timed out: # telnet 123.45.67.89 3306 Trying 123.45.67.89... telnet: connect to address 123.45.67.89: Connection timed out
What does that mean?0 -
That means there's something preventing you from connecting to the remote server. Suggestions are: [LIST] - The remote server blacklisted or denied the IP of the local server.
- The remote server is denying connecting to port 3306.
- The local server can't make remote connections to port 3306 (port blocked).
- The local server blacklisted or denied the IP of the remote server. Re-check all those 4 suggestions and I'm sure you will find the issue in one of them. Thanks,
0 -
I found it; it turns out that I needed to whitelist the main server in the firewall of the remote server. I confused that the remote server's firewall was preventing it from making an outgoing connection, but... it was. Go figure. Thanks for the help! 0 -
Really glad that the issue has been solved. Thanks for the letting us know. Greetings, 0 -
Hello :) I am happy to see the issue is now resolved. Thank you for updating us with the outcome. 0
Please sign in to leave a comment.
Comments
6 comments