I am trying to make siteA.com to connect to the database of siteB.com.However i am getting connection timed out.I already added siteA.com as a "Remote Database Access Hosts" in cpanel used by siteB.com but still no luck.
SiteA and siteB are on 2 different hosts and in case i put both on the same host , they work just fine.
P.S i am using php PDO to setup the connection
Here is my mysql connection setting for siteA
<?php
$hostname = "ipaddressofSiteB";
$db_name = "mybigdb";
$db_user = "harry";
$db_pass = "fcr2^WK&M";
?>
My webhost had blocked remote mysql connection
Had to contact them with ip of SiteB and port (3306) for them to unblock outgoing connections
Try to check:
bind-address
in MySQL configuration on siteB.com (located in /etc/my.cnf
or /etc/mysql/my.cnf
in most cases), because if bind-address
is set to 127.0.0.1
only local connections will be accepted.BTW, you can do faster/simpler connection testing through telnet
:
user@pc:~$ telnet siteB.com 3306