I am following this tutorial to try and connect to my remote database on Microsoft Azure.
I am trying to follow this tutorial here.
The code is reproduces below for ease of access:
$sUsername = '*****';
$sPassword = '*****';
$sHost = 'eu-cdbr-azure-west-d.cloudapp.net';
$sDb = 'database';
try {
$oConn = new PDO('mysql:host='.$sHost.';dbname='.$sDb, $sUsername, $sPassword);
$oConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo 'Sucess!';
} catch(PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}
I'm getting this error:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'eu-cdbr-azure-west-d.cloudapp.net' (110)' in db-connector.php:46
Stack trace:
#0 db-connector.php(46): PDO->__construct('mysql:host=eu-c...', 'bfb1d94b7476ad', 'bf430620')
#1 {main}
thrown in /home/maltawed/public_html/library/db-connector.php on line 46`