[英]Connecting PHP to Cloud MYSQL Google Apps
I am trying to connect my google app to a google cloud SQL instance, I have followed all the documentation and have read every page here I can find but no luck so far. 我正在尝试将我的Google应用连接到Google Cloud SQL实例,我已经阅读了所有文档,并阅读了我能找到的所有页面,但到目前为止还没有运气。
I am connecting using this - 我正在使用此连接-
<?php
$host = ":/cloudsql/<your-project-id>:<your-instance-name>";
$user = "root";
$password = " ";
$datbase = "cloudbooks";
mysql_connect($host,$user,$password);
mysql_select_db($datbase);
?>
The error I am getting is 我得到的错误是
Unable to find the socket transport "unix" - did you forget to enable it when you configured PHP?
Any help would be amazing! 任何帮助都将是惊人的!
First thing's last.. Do not use mysql_
instead use mysqli_
for all the reasons on this you can check this : Stackoverflow mysql_ 第一件事是最后..出于所有原因,请不要使用
mysql_
而是使用mysqli_
,您可以检查此: Stackoverflow mysql_
Moving on from that, there is no reason you should think of connecting to a MySQL server any different just because of how its hosted. 从那开始,没有理由只因为托管方式而考虑连接到MySQL服务器。 Cloud is a wonderfull Buzz word.. But its nothing new, its still just a host.
云是一个很棒的Buzz词。但是它并不是什么新鲜事物,它仍然只是宿主。
So you can use the following in your connection construction. 因此,您可以在连接构造中使用以下内容。
$host = "hostname // IP";
$user = "username";
$password = "password";
$datbase = "your_database";
There is actually some documentation also on this : google 'cloud' MySQL 实际上也有一些文档: google'cloud'MySQL
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.