1

Having trouble connecting Laravel 5.2 on Google Cloud. I created a new MySQL 5.6 second generation instance, and added the connection parameters in conf/database with the external ip of the instance, locally the laravel server is working fine.

But, when I deploy the code on the google cloud, it gives me errors regarding unix socket.

My question is, what are the correct connection parameters for usage of the database instance inside the cloud engine app ?

So, should I put only the database name and db_host to be: localhost on the server, or empty or the external ip address of the mysql instance ?

I assume I need to use an unix socket, however, I didn't found any active unix socket file using the Google clouds console.

1 Answers1

1

It turns out I should put this syntax:

DB_SOCKET=/cloudsql/myappengineapp:europe-west1:mysqlinstance1

inside my .env file.

the syntax is: the unix socket name:

/cloudsql/

content of:

gcloud sql instances describe

connectionName

property

As for the unix socket was not found, it was only in the Google SQL console, since it wasn't a full access or something.

  • The correct socket path on App Engine also given in the documentation [Using Google Cloud SQL with PHP](https://cloud.google.com/appengine/docs/php/cloud-sql/#setting-up) – Adam Jan 28 '17 at 20:22