dongxun4110 2018-05-14 00:06 采纳率: 0%
浏览 213

如何使用PDO ssl连接到azure mysql数据库

I am using PDO to connect to Azure Mysql database. I have got the file i was instructed to download.

 array(
    PDO::MYSQL_ATTR_SSL_CA => '/BaltimoreCyberTrustRoot.crt.pem.txt',$port

)

But i get an error The Connection failed: SQLSTATE[HY000] [2002]

I have looked at the connection strings provided by AZURE for PHP and i didnt find one of PDO using SSL_CA like others Thanks for the help

  • 写回答

1条回答 默认 最新

  • dtzhfb4869 2018-05-14 03:12
    关注

    Which PHP version are you using? Try to use the latest one. If you enabled “peer verification”, disable it and try again. Also, try to generate a new SSL Certificate and test an endpoint on the server to ensure that it is working properly. As per this SO thread: How do I connect to a MySQL database over SSL with Laravel 5.3, If you require to use "--ssl-mode=VERIFY_IDENTITY", then you can ping your server name to resolve the regional server name, such as westeurope1-a.control.database.windows.net, and use that regional server name in the connection until this issue is resolved. Change the DB_HOST to that region and try it again.

    评论

报告相同问题?