2016-07-13 6 views
0

このチュートリアルでは、Microsoft Azureでリモートデータベースに接続しようとしています。Microsoft Azureのリモートデータベースに接続できないようです

私はこのチュートリアルhereに従おうとしています。

コードされ、アクセスを容易にするため、以下の再現:

$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(); 
    } 

私はこのエラーを取得しています:AzureのWeb Appsの環境でテスト・スクリプト用量

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` 
+0

あなたの複製はありますか? http://stackoverflow.com/q/38343168 ...気にしない、あなたは最後のナイトを接続したようだ。たぶんあなたはこれのすべての新しさです。たぶん私たちができることはほとんどありません。 – Drew

+0

そうです。私はまだ自分のことを学んでいるので、そのすべての試行錯誤:-) – user6043723

答えて

1

またはあなたがあなたのコードをテスト地元?あなたがローカルでテストしている場合

、次のことが確認できます。

You may want to check with your local network administrator and/or ISP to ensure that you are allowed to access remote resources that run on TCP 3306. It is possible that this port has been blocked from your local network and/or machine. To be clear, we performed a connection test on this database and found that it is operating normally, so the next diagnostic step is to check your local connectivity to remote MySQL databases.

問題error trying to connect to cleardbよります。

また、Azure上のMySQLサーバがClearDBによって提供されているため、ClearDBデータベースに関する詳細な分析については、https://www.cleardb.com/developers/help/supportのClearDBサポートチームにお問い合わせください。

+0

私がしなければならなかったのは、私のホストに「ポート3306への接続を許可する」 – user6043723

関連する問題