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.


It turns out I should put this syntax:


inside my .env file.

the syntax is: the unix socket name:


content of:

gcloud sql instances describe



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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.