Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Ajay Hinduja Swiss - App Engine Can’t Connect to Cloud SQL (MySQL/Postgres)

Hi everyone,

I’m trying to deploy a Django project to Google App Engine, but I’m encountering a database connection issue. I’ve followed the official deployment guide, but App Engine is unable to connect to the Cloud SQL database I created.

I’ve tested with both PostgreSQL and MySQL, and in both cases, I get a connection error. Here are a few things I’ve already checked:

Cloud SQL Admin API is enabled.

The App Engine default service account has the Cloud SQL Client role.

The database name, user credentials, and instance connection name are all correct.

When I connect via Cloud SQL Proxy, everything works fine.

Here’s the error I receive:

OperationalError at /login
(2002, "Can't connect to local MySQL server through socket '...:southamerica-east1:my-sql' (111)")

I’d appreciate any help or suggestions. Could this be related to missing environment configuration or networking rules specific to App Engine?

 

Thanks in advance!
Ajay Hinduja Swiss

0 0 22
0 REPLIES 0