简体   繁体   English

Google App Engine-使用mysqli用php连接到SQL Cloud实例

[英]Google App Engine - Connect to SQL Cloud Instance with php using mysqli

I've spent hours trying to figure out how to connect my Google App Engine project to my Cloud SQL instance using php with mysqli. 我花了数小时试图弄清楚如何使用php和mysqli将Google App Engine项目连接到Cloud SQL实例。

I found googles tutorial to be useless as it is with PDO and I couldn't get it to work. 我发现Google教程由于与PDO无关而无用,因此无法正常工作。

Any Ideas? 有任何想法吗?

Thanks for asking Cam, here's what I (you) did... 感谢您询问Cam,这是我(您)所做的...

Your mysqli creation statement should mimic below. 您的mysqli创建语句应在下面模仿。

 new mysqli(null, "root", '<rootUserPassword>', "<dbName>", null, "/cloudsql/<instanceConnectionName>");

with root being the the default username assigned to the database root是分配给数据库的默认用户名

Note, this is for second generation cloud sql instances. 注意,这适用于第二代云SQL实例。 I haven't tested this on first generation. 我还没有在第一代测试过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM