1

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.

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!

Moe Far
  • 2,742
  • 2
  • 23
  • 41
Daviepark
  • 65
  • 1
  • 11
  • .. why dont you just use the normal, hostname, user and password provided to you? There is nothing special about "cloud MySQL" its still just MySQL.. Also do not yse `mysql_` its deprecated.. At least use `mysqli_` – Pogrindis May 25 '15 at 12:20

1 Answers1

1

First thing's last.. Do not use mysql_ instead use mysqli_ for all the reasons on this you can check this : 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. Cloud is a wonderfull Buzz word.. But its nothing new, its still just a host.

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

Community
  • 1
  • 1
Pogrindis
  • 7,755
  • 5
  • 31
  • 44