AnuarJamlus
asked on
Cannot access remote mysql host on a CPanel server
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-conn ect]: (HY000/2003): Can't connect to MySQL server on '173.199.132.92' (4) in /var/www/vhosts/feedsmanag ement.com/ httpdocs/c p/lib/Simp leTools/Si mpleMySQL. 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!
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-conn
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!
Check firewall on src and dst host. is they allow connections on mysql port.
ASKER
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.
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.
test outbound connection on plesk server port 3306
telnet <dst ip> 3306
ASKER
At the moment it is stuck at
Trying 173.199.132.92...
Does that mean it's the plesk firewall that's blocking?
Trying 173.199.132.92...
Does that mean it's the plesk firewall that's blocking?
yes. you cant connect on 3306 mysql port.
reconfigure or turnoff firewall.
and one thing more, test is dst host reacheble:
reconfigure or turnoff firewall.
and one thing more, test is dst host reacheble:
ping <dst ip>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
ASKER
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.
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.
ASKER
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!
Thanks!