Google AppEngine Flexible PHP - "SQLSTATE[HY000] [2002] No such file or directory"

41 views
Skip to first unread message

Hampus Boås

unread,
Sep 11, 2019, 7:51:58 AM9/11/19
to Google App Engine
Hello, 

I have several projects on Google AppEngine Flexible, but one of my projects randomly after a couple of days looses the ability to connect to the database.

I'm using the unix socket to connect and i have SQL Admin activated. If i debug the sql instance and the flexible instance they are both up and running.

My DB User has privileges from any host.

The PDO error says "SQLSTATE[HY000] [2002] No such file or directory".

This has happen a couple of times now.

Has someone have this issues before?
I don't really know what to do here.

Best regards Hampus

Mua Rachmann

unread,
Sep 11, 2019, 8:11:07 AM9/11/19
to google-a...@googlegroups.com
Hi Hampus,

Is your app.yaml file well configured with the database credentials? such as connection name, database name etc etc.

DB_CONNECTION: mysql
DB_HOST: localhost
DB_DATABASE: xxxxxxx
DB_USERNAME: xxxxxx
DB_PASSWORD: xxxxxxxxxxx
DB_SOCKET: /cloudsql/<project_id>:us-central1:<database-instance>

If running on beta

beta_settings:
# for Cloud SQL, set this value to the Cloud SQL connection name,
cloud_sql_instances: <project_id>:us-central1:<database-instance>
You might want to check if you did not maybe omit something. Talking prior to the fact you said it worked a couple 
of days ago.

Regards,
Mua

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/ecec867c-ebeb-4093-b603-127ed9e03449%40googlegroups.com.

George (Cloud Platform Support)

unread,
Sep 11, 2019, 10:02:03 AM9/11/19
to Google App Engine
Hello Humpus, 

Have you set the host to 'localhost' or '127.0.0.1' ? This is strictly for testing locally during development, unsuitable for deployed applications running in production.

This discussion Group is meant for general discussion, voicing of opinions, and socializing, and is not for technical support. For further technical support with error-free connecting your App Engine app to Cloud SQL, it is recommended to post your detailed questions [3] to Stack Exchange [4] using the supported Cloud tags.
Message has been deleted

Hampus Boås

unread,
Sep 13, 2019, 9:15:22 AM9/13/19
to Google App Engine
Hello,

Thank you for the quick response, 
I will try adding the env variables to the app.yml file.
I've already have the beta setting. 

The strange thing about this, is that the server is responding for some days. But suddenly looses the connection ability to the SQL.

Tanks!
To unsubscribe from this group and stop receiving emails from it, send an email to google-a...@googlegroups.com.

Hampus Boås

unread,
Sep 13, 2019, 9:15:22 AM9/13/19
to Google App Engine
Hello, 

Do you mean the database-user host?

Thanks you

George (Cloud Platform Support)

unread,
Sep 13, 2019, 11:52:08 AM9/13/19
to Google App Engine
Hi Hampus, 

Indeed, I was thinking about user creation, as describe on the "Creating and managing MySQL users" users page, "Creating a user" sub-chapter, step 5: "Optionally, a Host".  

If you would like us to take a closer look at this situation, you should post a similar issue in Public Issue Tracker, where privacy levels can be adjusted so private information, such as project names, may be provided. 
Reply all
Reply to author
Forward
0 new messages