We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Cannot access remote mysql host on a CPanel server

Medium Priority
1,161 Views
Last Modified: 2012-05-11
I have a script that is residing on a Plesk server. I have another server that's running CPanel to host the MySQL server.

In Cpanel and WHM I have added the IP of the plesk server to the Remote Database Access Hosts and Additional MySQL Access Hosts respectively.

However when I try to run the script I get the following error:

Warning: mysqli::real_connect() [function.mysqli-real-connect]: (HY000/2003): Can't connect to MySQL server on '173.199.132.92' (4) in /var/www/vhosts/feedsmanagement.com/httpdocs/cp/lib/SimpleTools/SimpleMySQL.php on line 193
Connection error: Can't connect to MySQL server on '173.199.132.92' (4)
Please correct your details and try again.

So what else do I need to do to get the connection to work?

Thanks!
Comment
Watch Question

Commented:
Check firewall on src and dst host. is they allow connections on mysql port.

Author

Commented:
The plesk server which is on 1and1 hosting has a firewall and I have allowed outgoing access to port 3306.

The mysql server itself does not have any firewall, or if there is I don't know about it. However I've never had to deal with firewalls while working on a cpanel/whm server.

Commented:
test outbound connection on plesk server port 3306

telnet <dst ip> 3306

Open in new window

Author

Commented:
At the moment it is stuck at

Trying 173.199.132.92...

Does that mean it's the plesk firewall that's blocking?

Commented:
yes. you cant connect on 3306 mysql port.

reconfigure or turnoff firewall.

and one thing more, test is dst host reacheble:

ping <dst ip>

Open in new window


Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Commented:
In your cpanel, Database> You need to add the ip to allowed host to connect to database.
You can get that in : Remote Database Access Hosts. Add the ip from which you are trying to connect to database. Also make sure that port 3306 is allowed for all incoming and outgoing traffic.

Author

Commented:
OK I think it's the server that's hosting the mysql database that isn't accepting connections.

So how do I allow it to accept connections. It's running Cpanel and WHM. I have already added the IP to the Remote Database Access Hosts so it's got to be something else.

Author

Commented:
The server where the mysql database is hosted on apparently has a ConfigServer Firewall installed. So in the end all it took was to add the other server's IP to the allow list.

Thanks!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.